简体   繁体   中英

Not been Able to Build Production Build for my ionic 2 app

I am trying to build the production build for my ionic app. Everything works fine if am running my app with:

ionic run android

But when i am trying to build my production app by using

ionic run android --prod

i am getting this error:

Cannot read property 'componentType' of undefined main.js:7.

and my app stays stuck at Splash Screen

Here is my package.json

 {
  "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": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/cloud-angular": "^0.11.0",
    "@ionic/storage": "1.1.7",
    "angular2-focus": "^1.0.3",
    "angular2-moment": "^1.1.0",
    "ionic-angular": "2.0.0-rc.4",
    "ionic-gallery-modal": "0.0.7",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "rxjs": "5.0.0-beta.12",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.0.0",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "App: An Ionic project"
}

The command is build not run . Try:

ionic build android --release --prod

run will build and run in your attached device or emulator

The problem is with the "page-name.module.ts" file that is created when you use the "ionic generate page" command. Create your pages manually and run it (ionic run android --prod) or (ionic build android --prod) again. it worked for me. Home they fix it soon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM