I have different env settings for each customer with each having it's own {{custName}}/environment.prod.ts file . I want to use their respective prod environment files with ng build --prod command. The problem I'm facing is even after specifiying the environment it's using the default environment.prod.ts
My package.json has script like
{.....
customer_a : "ng build --prod --environment=custA_prod",
....}
In angular-cli.json I have mentioned the path which goes something like this
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts",
"qa": "environments/environment.qa.ts",
"custA_prod": "environments/custA/environment.prod.ts"
}
Is it possible to use all the features of prod build but with some different environment settings ?
mark as production mode on you enviorement file:
environments/custA/environment.prod.ts File:
export const environment = {
production: true,
envName: "custA_prod",
.....
};
Or add main.ts your custom check:
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production || environment.envName == 'custA_prod') {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);