Right way to build

Hello,

I have the following doubt about build to production:
When I run with --prod flag, my app start more fast than --release flag. It’s a considerable time (about 5~6 seconds).
So, what I need to do when I do a build?

Thank you

  • --prod activates a special kind of build process that makes our app faster
  • --release actives a relase mode build - vs. the default --debug build.
  • You want to build using --prod --release for the version that you upload to the stores.

Ok, these two flags works with ionic package command?

Yes. --prod is for the local build, which then will be uploaded to ionic package where --release will be used to build a release app.

If --prod makes any build faster, how come it’s not the default? Are there inconvenients to using it?

I’m sorry, but isn’t totally clear to me. So, if I want to run my apps with prod opening speed I need to follow this steps?
1 - ionic cordova build android --prod
2 - ionic package build android --profile prod_profile --release

ionic package command with --release flag uses the last build (in this case with --prod flag) or it creates a new one?

If --prod makes any build faster, how come it’s not the default? Are there inconvenients to using it?

Good question

It does more work during the build process and so takes longer to execute. It also makes the code more “complicated” to debug. Typical concept of current frameworks.

You should be able to put all that in one command:

ionic package build android --prod --release --profile prod_profile

Because ionic package first executes a normal build local (outputsRunning app-scripts build: in the consoleor similar - thenbuild dev started …for no param,build prod started …when you use–prod). The other two params then tell ionic package` on the server what to do.

1 Like