gshigeto / ionic-environment-variables

Easy to use environment variables for Ionic3!
MIT License
276 stars 36 forks source link

Everytime its load the last environment file #30

Closed rajanshahsa closed 6 years ago

rajanshahsa commented 6 years ago

Hello,

I have 5 environments in my project and what I want like

IC_ENV=stage ionic cordova emulate ios -l  //environment.stage.ts should used
IC_ENV=dev ionic cordova emulate ios -l  //environment.dev.ts should used
IC_ENV=prod ionic cordova emulate ios -l  //environment.prod.ts should used
IC_ENV=local ionic cordova emulate ios -l  //environment.local.ts should used
IC_ENV=demo ionic cordova emulate ios -l  //environment.demo.ts should used

useDefaultConfig.prod.resolve.alias = {
  "@app/env": path.resolve(environmentPath('prod'))
};

useDefaultConfig.dev.resolve.alias = {
  "@app/env": path.resolve(environmentPath('dev'))
};

useDefaultConfig.demo.resolve.alias = {
  "@app/env": path.resolve(environmentPath('demo'))
};

useDefaultConfig.local.resolve.alias = {
  "@app/env": path.resolve(environmentPath('local'))
};

useDefaultConfig.stage.resolve.alias = {
  "@app/env": path.resolve(environmentPath('stage'))
};

But every time my "environment.stage.ts" file is used as it's last. Can anyone explain to me what I am doing wrong?