--release build much slower than --prod

Hey!

There are several ways to build with ionic 3, which are not really explained in detail in the docs:

The start time of my app varies drastically with the different builds:

ionic cordova run android --release
-> app start time 8 seconds

ionic cordova run android --prod
-> app start time 3 seconds

ionic cordova run android --prod --release
-> app start time 8 seconds

Would there be any reason for me not to build with just --prod? And if yes, what could I do to make --prod --release faster? (8 seconds is a not acceptable start up time for my pretty lightweight app)

Something is wrong here.

--prod and --release have similar names, but do different things: Prod optimizes the code, Release makes it build in a different way so the app can be released to the stores. You have to use both for a fast version that can be released.

You will have to find out why --prod --release makes a slower build for you.

Can you post the whole output of that command?
Also your ionic info output?

2 Likes

When I build with --prod I can see the extra optimization steps (e.g. AOT, uglify, minify) happening so that gives me an idea of what is happening.

I haven’t tried to build with --release yet but for my education can you explain what extra steps the build does?
I can look at github for the details, but explaining at a high or conceptual level would be helpful.

It builds the app a different way with different certificates and removes the debugging stuff (--debug is default and opposite of --release)

Hey, thank you very much for your explanation!

I ran

cordova run android --prod --release – --keystore=MyApp.keystore --alias=MyApp

and it just worked fine, although it didn’t back then

(Offtopic but important: Make sure to include ionic in front of the command.)

1 Like

Why should i include ionic command before cordova’s ?