Ionic-3 应用程序的生产构建失败
Failing Production Build of Ionic-3 app
我正在使用 Ionic-3 构建应用程序。我正在使用以下命令来构建应用程序 -
ionic cordova build android --prod
应用程序启动时抛出以下错误 -
Uncaught Error: Cannot find module "."
at vendor.js:1
at vendor.js:1
at Object.<anonymous> (vendor.js:1)
However when I build without “–prod” flag, app build just fine.
这是我的 package.json 文件:
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”: “5.2.9”,
“@angular/compiler”: “5.2.9”,
“@angular/compiler-cli”: “5.**strong text**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”
]
}
}
我通过降级 Typescript 版本尝试了一些解决方案 -
~2.6.6 但对我不起作用。
感觉可能和app-script下载的依赖有关。其中之一不向后兼容。虽然不确定。
请帮忙??
我通过 -
解决了这个问题
ionic cordova build android --minifycss --optimizejs --minifyjs --release
prod 内部使用这些,但似乎存在 aot(Ahead Of Time) 并发症/电子邮件模式匹配问题,它会导致构建失败。
:)
我正在使用 Ionic-3 构建应用程序。我正在使用以下命令来构建应用程序 -
ionic cordova build android --prod
应用程序启动时抛出以下错误 -
Uncaught Error: Cannot find module "."
at vendor.js:1
at vendor.js:1
at Object.<anonymous> (vendor.js:1)
However when I build without “–prod” flag, app build just fine.
这是我的 package.json 文件: 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”: “5.2.9”,
“@angular/compiler”: “5.2.9”,
“@angular/compiler-cli”: “5.**strong text**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”
]
}
}
我通过降级 Typescript 版本尝试了一些解决方案 - ~2.6.6 但对我不起作用。
感觉可能和app-script下载的依赖有关。其中之一不向后兼容。虽然不确定。
请帮忙??
我通过 -
解决了这个问题ionic cordova build android --minifycss --optimizejs --minifyjs --release
prod 内部使用这些,但似乎存在 aot(Ahead Of Time) 并发症/电子邮件模式匹配问题,它会导致构建失败。 :)