Is enableProdMode necessary?


#1

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


enableProdMode() question
#4

app-scripts deals with all this for you.


#5

So enableProdMode is a concept Ionic developers can ignore fully?


#6

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


#7

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.


#8

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.


#9

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


#10

thank you all guys :slight_smile:


#11

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).


#12

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