Is enableProdMode necessary?

Hello everyone,
I’ve just ported my Ionic 2 Android app to version 3, and I’ve read that putting enableProdMode() should make the app faster to start.
Unfortunately, the startup time remained the same: about 6 seconds :frowning:
My question is: since enableProdMode caused no relevant effect, (and I get no message that Angular runs in dev mode), can I remove enableProdMode from my code?

Thanks to the Ionic 2 Team for their amazing platform :slight_smile:

Francesco

3 Likes

app-scripts deals with all this for you.

3 Likes

So enableProdMode is a concept Ionic developers can ignore fully?

1 Like

Aye. It is now handled/added by ionic-app-scripts. (When you run with --prod)

1 Like

Yes. It always sort of has been, but how it got automatically done changed a bit. Before app-scripts 0.0.47, there were two main files - one prod, one dev - in the app starter code, and app-scripts chose which one to use. Starting with 0.0.47, there’s only one main file and app-scripts rewrites it on the fly to add enableProdMode() as needed.

1 Like

Great.

I wonder if it is possible to supress the console output concerning enableProdMode when you are just using ionic serve… Not really necessary - and that put me onto the impression I would still have to do something about it.

Not trivial, because that comes from deep within Angular itself, not something under Ionic control.

1 Like

thank you all guys :slight_smile:

Perhaps Ionic could print its own line of console output, after the one from Angular, saying that Ionic takes care of this for you when doing run or build with the --prod flag. Or possibly a link to some documentation which describes, in sufficient detail, the effect of the --prod flag. I too was worried about the Angular message (which is how I ended up on this forum thread).

1 Like

Please open an issue with your suggestion at Github: https://github.com/ionic-team/ionic
Sounds like a valid idea.