I try many way to set up environment variables in ionic3:
ENVIRONMENT VARIABLES IN IONIC 2
How to set up environment specific configurations with Ionic and Webpack
Ionic 2 Environment Variables: The Best Way
But each solution failed on my project.
The process.env.IONIC_ENV is always equal to dev even if I do ionic serve --prod or something else.
I don't understand why... Am I doing something wrong or forget to do something? And by the way which of this solution is the more flexible?
You cannot use ionic serve --prod.
ionic serve starts a local dev server for app dev/testing.
If you need to test your app on production mode then you need to run below CLI command.After that, you can test your app on your device which has been attached to your PC using USB cable.
ionic cordova run android --prod --device
Here is the list of options which you can do with ionic serve
This is for build CLI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With