source Link source Link
ng generate environments
-
make sure that :
import { environment } from './../environments/environment';
-
The
build
command usesenvironment.ts
as the build target when no environment is specified
-
angular.json
"configurations": { "development": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.development.ts" } ], …
-
This means that when you build your development configuration with
ng build --configuration development
, thesrc/environments/environment.ts
file is replaced with the target-specific version of the file,src/environments/environment.development.ts.
-
we learn :
-
ng build --configuration=production
-
ng build --configuration=development
-
ng serve --configuration=production
-
ng serve --configuration=development
-