Ionic 4 environments

I’ve followed the following tutorial:

It’s working fine, but building with cordova, doesn’t make use of the Angular environments.
(So, ionic cordova run android --prod) uses the stock url instead of the prod url.

Is it on the roadmap for Ionic 4? Using Angular prod environment instead of something hidden in Ionic? And if so, can we add more Angular environments (So we can work with dev, test, acceptance & production environments) to work with the ionic cordova build environment??

6 Likes

I’ve the same problem, I need to create ios and android specific environment.ts files but when I run the command

ionic cordova build ios --env=devios

The environment.devios.ts file is ignored

Have you found any solution for this? I have the same problem …

Best way to do is (Ionic 4)

  1. Create an environment file environment.live.ts

  2. modify angular.json file
    add configuration live under architect


    do the same under serve
    image

  3. run command
    ionic cordova build android --configuration live

-------------Hope it will help--------------

4 Likes

For making build using ionic cordova build , configuration also hsve to be added to “ionic-cordova-serve” in angular.json
then after you could make build or run your app with
ionic cordova build android --configuration live

2 Likes