Change constants depending on enviroment



I have several backend services in my project that use different URLs depending on which environment I build for (develop, production, demo, etc).

Until now, I change this values depending on enviroment with Gulp script, but migranting to RC0, there are a step “Delete the gulpfile.js”.

My question is, How to do that in Ionic 2? In this RC, were added two files, and In the new releases there are nothing about this files, but in the Ionic 2 Conference Application they were removed. There is just a file called main.ts.

What can I do? This is a bug?


I use a modified version of a cordova hook presented here:

Basically I have a config folder that has a “”, “”, etc. During the build process I execute:

“config_target=qa ionic build ios”

The hook will pull in the correct environment specific json file to the assets/api folder using the name “config.json”. I have a provider that loads the the config.json and then I inject that into other components that may needed it. Working good so far until we have an official solution from the ionic team.


It’s worked, thanks.

I realy expect a better and native solution from Ionic Team.