# Failing Production Build of Ionic-3 app

**URL:** <https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758>\
**Category:** ionic-v3\
**Created:** [July 30, 2018, 2:09pm UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758 "2018-07-30T14:09:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivamethical](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@shivamethical](https://forum.ionicframework.com/u/shivamethical)\
**Post date:** [July 30, 2018, 2:09pm UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/1 "2018-07-30T14:09:24Z")

</div>

Hi,  
I am building an app using Ionic-3. I am using follwing command to build the app -  
ionic cordova build android --prod  
When app starts it throws follwing error -  
**Uncaught Error: Cannot find module "."**  
\*\* at vendor.js:1\*\*  
\*\* at vendor.js:1\*\*  
\*\* at Object. (vendor.js:1)\*\*

However when I build without “–prod” flag, app build just fine.

Here is my package.json file:  
**Package.json -**

```auto
{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@ionic-native/camera": "4.7.0",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/device": "4.7.0",
    "@ionic-native/firebase": "4.7.0",
    "@ionic-native/in-app-browser": "4.7.0",
    "@ionic-native/keyboard": "4.7.0",
    "@ionic-native/push": "4.7.0",
    "@ionic-native/social-sharing": "4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/storage": "2.1.3",
    "@journeyapps/cordova-plugin-broadcaster": "file:cordova-plugin-broadcaster",
    "Applozic-Cordova-Ionic-PhoneGap-Chat-Plugin": "file:Applozic-Cordova-Ionic-PhoneGap-Chat-Plugin-master",
    "angularfire2": "^5.0.0-rc.6.0",
    "com.applozic.phonegap": "Applozic-Cordova-Ionic-PhoneGap-Chat-Plugin-master",
    "com.razorpay.cordova": "file:razorpay-cordova-master",
    "cordova-android": "6.4.0",
    "cordova-ios": "4.5.4",
    "cordova-plugin-broadcaster": "cordova-plugin-broadcaster",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-console": "^1.1.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-firebase": "file:cordova-plugin-firebase",
    "cordova-plugin-inappbrowser": "^1.7.2",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.3.2",
    "es6-promise-plugin": "^4.2.2",
    "firebase": "4.12.1",
    "ionic-angular": "3.9.2",
    "ionic-img-viewer": "^2.4.0",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "jquery": "^3.2.1",
    "moment": "^2.21.0",
    "ng2-translate": "^5.0.0",
    "promise-polyfill": "^6.1.0",
    "rxjs": "5.5.2",
    "socket.io-client": "^2.0.1",
    "sw-toolbox": "3.6.0",
    "underscore": "^1.8.3",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.8",
    "@types/jquery": "^2.0.49",
    "@types/underscore": "^1.8.8",
    "typescript": "^2.7.2"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist"
  ],
  "cordovaPlatforms": [],
  "description": "app2: An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-device": {},
      "cordova-plugin-inappbrowser": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-splashscreen": {},
      "com.razorpay.cordova": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-broadcaster": {},
      "com.applozic.phonegap": {},
      "cordova-plugin-firebase": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

```

I tried some solution by downgrading the Typescript version -  
~2.6.6 but not worked for me .

I feel that it may be related to app-script downloaded dependencies. And one of them not backward compatible. Not sure though.

**Please help ??**

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 30, 2018, 3:30pm UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/2 "2018-07-30T15:30:42Z")

</div>

What are the dependencies if you start a new app right now? Make sure yours match those - those are “known good” for Ionic apps.

---

<div class="post-metadata">

**Author:** ![shivamethical](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@shivamethical](https://forum.ionicframework.com/u/shivamethical)\
**Post date:** [July 31, 2018, 4:46am UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/3 "2018-07-31T04:46:38Z")

</div>

> [@Sujan12](#):
>
> What are the dependencies if you start a new app right now? Make sure yours match those - those are “known good” for Ionic apps.

Hi Sujan , what do you mean by dependency of a new app ? i have existing project and was working well till last build.

---

<div class="post-metadata">

**Author:** ![InfantJoseph](https://avatars.discourse-cdn.com/v4/letter/i/2acd7d/32.png) [@InfantJoseph](https://forum.ionicframework.com/u/InfantJoseph)\
**Post date:** [July 31, 2018, 5:44am UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/4 "2018-07-31T05:44:57Z")

</div>

You could use the below command to get a release build.

`ionic cordova build android --minifycss --optimizejs --minifyjs --release`

`prod` internally uses these but there seems to be a problem in **aot** (Ahead Of Time) complication / email pattern matching issue and it causes build failure.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 31, 2018, 7:57am UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/5 "2018-07-31T07:57:36Z")

</div>

Start a new project with `ionic start`, then compare the `package.json` to what you have. If one of your dependencies are newer than what the new app got, you are too far and it is probably not supported by Ionic (yet).

---

<div class="post-metadata">

**Author:** ![shivamethical](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@shivamethical](https://forum.ionicframework.com/u/shivamethical)\
**Post date:** [July 31, 2018, 8:29am UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/6 "2018-07-31T08:29:33Z")

</div>

> [@InfantJoseph](#):
>
> `ionic cordova build android --minifycss --optimizejs --minifyjs --release`

Hey Thanks Man !!! it helps me out … 🙂

---

<div class="post-metadata">

**Author:** ![neeraju](https://avatars.discourse-cdn.com/v4/letter/n/59ef9b/32.png) [@neeraju](https://forum.ionicframework.com/u/neeraju)\
**Post date:** [September 11, 2019, 2:32pm UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/7 "2019-09-11T14:32:42Z")

</div>

Thanks man ,  
I have been stuck in this issue for last 3-4 hrs,i had tried everything,your solution saved my day…  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:28pm UTC](https://forum.ionicframework.com/t/failing-production-build-of-ionic-3-app/136758/8 "2021-07-19T21:28:34Z")

</div>

Closed on July 19, 2021, 9:28pm UTC


