19

When running an ionic build I'm curious as to the difference between the --prod and --release flags?

The Ionic build docs state:

--prod Build the application for production
--release Create a Cordova release build

and while the Cordova CLI ref doesn't mention a --prod flag, it states the following for --release:

Perform a release build. This typically translates to release mode for the underlying platform being built.

Looking at the difference in the build output, building with --prod seems to run an Ionic 'production' build, in that it also runs the ngc and uglify (which itself runs cleancss) tasks.

And when I run a build with --release, I seem to get a Cordova release build, which (per the docs) attempts to run a release build on whatever platform you're targeting.

Are those the only differences, or am I over-simplifying?

For reference, note the following output APK filesizes:

  • Prod flag: 9.8 MB
  • Release flag: 11.7 MB
  • Prod + Release flags: 8.9 MB

I'm using the latest (ATTOW) version of the Ionic Framework (3.9.2) and CLI (3.20.0).

Sensei James
  • 2,617
  • 30
  • 36

2 Answers2

13

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.

As Sujan12 says on this link.

Sensei James
  • 2,617
  • 30
  • 36
  • The current documentation for publishing to the app store only uses the --prod flag. Is --release no longer used? https://ionicframework.com/docs/publishing/app-store – pdiffley Feb 13 '20 at 03:39
0

This solution may sound stupid but you need to delete/uninstall the old .apk from your android phone, and then try installing new.

ionic cordova build android --prod --release

worked for me!