问题
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).
回答1:
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.
来源:https://stackoverflow.com/questions/49581363/ionic-build-difference-between-prod-and-release-flags