Ionic App takes too long to start

I also have the same problem and tried all of these possible solutions but still my problem is not resolved ?? Even I deleted node modules and again install cordova ionic 3 please guide, ??

have you added following code?

import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {enableProdMode} from "@angular/core";
import {AppModule} from "./app.module";
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

yes i also tried this

THat is not necessary or useful as the build process will do that by itself. You don’t have to manually do this.

i tried all these methods but still having this issue

It’s the solution?

Thx!

It works like a charm. Thanks!!!

Your welcome. :slightly_smiling_face:

–prod flag not working in xCode 10 as it need a workaround

--buildFlag="-UseModernBuildSystem=0"

please what’s the solution you work for you

Hello all,

I am using command " ionic cordova build android --prod --aot --minifyjs --minifycss --optimizejs " to create and build but having following issue… Please suggest what should i do my main aim to minimise the loading time of splash screen currently it is taking almost 16-18sec to load.

Logs :

[14:46:59] ionic-app-scripts 3.2.2
[14:46:59] build prod started …
[14:46:59] clean started …
[14:46:59] clean finished in 2 ms
[14:46:59] copy started …
[14:47:00] deeplinks started …
[14:47:02] deeplinks finished in 2.07 s
[14:47:02] ngc started …
[14:47:08] ionic-app-script task: ā€œbuildā€
[14:47:08] TypeError: Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf ()
at Object.__extends (D:\IonicProjects\brainmintmoodle3-mobile\node_modules\tslib\tslib.js:65:9)
at D:\IonicProjects\brainmintmoodle3-mobile\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:115:17
at D:\IonicProjects\brainmintmoodle3-mobile\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:314:6
at D:\IonicProjects\brainmintmoodle3-mobile\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:3:17
at Object. (D:\IonicProjects\brainmintmoodle3-mobile\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! moodlemobile@3.7.0 ionic:build: node --max-old-space-size=16384 ./node_modules/@ionic/app-scripts/bin/ionic-app-scripts.js build "--prod" "--aot" "--minifyjs" "--minifycss" "--optimizejs" "--target" "cordova" "--platform" "android"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the moodlemobile@3.7.0 ionic:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Roaming\npm-cache_logs\2019-11-26T09_17_08_210Z-debug.log
[ERROR] An error occurred while running subprocess npm.