在我的 Ionic 3 项目上工作了一段时间后,有些事情发生了变化。我在 Ionic Framework 论坛上进行了谷歌搜索,但没有任何回应,这个问题很常见。
希望有人能帮忙。
当我运行命令 ionic build --prod
(或 Ionic cordova build android --prod
)时,它会在某个阶段卡住并开始消耗无限的 RAM。
详细信息如下:
所以我必须杀死该进程,否则它将以内存堆结束。
我的package.json
是这样的:
{
"name": "grocery",
"version": "1.3.0",
"author": "hussemsoft@gmail.com",
"homepage": "http://www.kunzo.sa/",
"private": true,
"config": {
"ionic_purge_unused_fonts": false
},
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "5.0.3",
"@angular/compiler": "5.0.3",
"@angular/compiler-cli": "5.0.3",
"@angular/core": "5.0.3",
"@angular/forms": "5.0.3",
"@angular/http": "5.0.3",
"@angular/platform-browser": "5.0.3",
"@angular/platform-browser-dynamic": "5.0.3",
"@ionic-native/call-number": "^4.7.0",
"@ionic-native/core": "4.4.0",
"@ionic-native/diagnostic": "^4.5.2",
"@ionic-native/firebase": "^4.5.3",
"@ionic-native/geolocation": "^4.5.2",
"@ionic-native/google-maps": "^4.5.2",
"@ionic-native/keyboard": "^4.5.2",
"@ionic-native/launch-navigator": "^4.7.0",
"@ionic-native/native-geocoder": "^4.5.2",
"@ionic-native/network": "^4.5.2",
"@ionic-native/screen-orientation": "^4.5.2",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "^4.5.3",
"@ionic/app-scripts": "^3.1.10",
"@ionic/pro": "1.0.16",
"@ionic/storage": "^2.1.3",
"@ngx-translate/core": "^9.0.2",
"@ngx-translate/http-loader": "^2.0.1",
"angularfire2": "^5.0.0-rc.5-next",
"call-number": "^1.0.1",
"cordova-android": "6.3.0",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-firebase": "^0.1.25",
"cordova-plugin-geolocation": "^3.0.0",
"cordova-plugin-googlemaps": "^2.3.6",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-nativegeocoder": "^2.0.5",
"cordova-plugin-network-information": "^1.3.4",
"cordova-plugin-screen-orientation": "^2.0.2",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova.plugins.diagnostic": "^3.9.2",
"es6-promise-plugin": "^4.2.2",
"firebase": "^4.10.0",
"imgcache.js": "^1.1.1",
"ionic-angular": "^3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"minimist": "^1.2.0",
"mx.ferreyra.callnumber": "0.0.2",
"promise-polyfill": "^6.1.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.2.1",
"xml2js": "^0.4.19",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.7.0",
"typescript": "2.4.2",
"uglify-es": "3.2.2"
},
"description": "Dukan app",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
},
"cordova-plugin-nativegeocoder": {},
"cordova.plugins.diagnostic": {},
"cordova-plugin-network-information": {},
"cordova-plugin-firebase": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-screen-orientation": {},
"ionic-plugin-keyboard": {},
"mx.ferreyra.callnumber": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"OKHTTP_VERSION": "3.+"
},
"call-number": {}
},
"platforms": [
"android"
]
}
}
ionic 信息给出:
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.10
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
System:
Android SDK Tools : 26.1.1
Node : v6.14.2
npm : 5.10.0
OS : Windows 10
Environment Variables:
ANDROID_HOME : C:\Users\HUSSEM-PC\AppData\Local\Android\sdk
Misc:
backend : pro
我很确定它与webpack
有关系。
最佳答案
稍等一下,如果它给你内存错误试试这个
关于javascript - --prod 在构建 Ionic 3 应用程序时不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51012352/