Right way to build


#1

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


#2
  • --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.

#3

Ok, these two flags works with ionic package command?


#4

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.


#5

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


#6

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


#7

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.


#8

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 tellionic package` on the server what to do.