Currently I have three different environments in Angular4:
- Environment
- Environment.Debug
- Environment.Release
Now, in vsts build pipeline I have set up multi-configuration where one definition prepares artifacts for debug and release:
I am using "Replace tokens" task to replace variables per debug and release environment, before I run npm install and npm run {either debug or release) which then runs webpack to pack files for debug or release environment.
I saw there is an option to replace variables in Release where you can replace variables in your .json file(like appsettings.json):
But problem is when webpack packs source code into one bundle.js I think I cannot use release to replace environment variables? Can I?
So what I want to achieve is decouple debug and release builds. This is simple I just recreate separate definitions for debug and release, where I am only replacing variables per environment. Second stage is to actually remove Replace tokens task from build pipeline and use Release variables section to replace variables per environment set up in Release. How is that possible for Angular after webpack builds bundle in js?