@@ -125,13 +125,19 @@ The build artifacts will be stored in the `dist/` directory.
125
125
126
126
### Build Targets and Environment Files
127
127
128
- A build can specify both a build target (` development ` or ` production ` ) and an
129
- environment file to be used with that build. By default, the development build
130
- target is used.
128
+ ` ng build` can specify both a build target (` --target=production ` or ` --target=development ` ) and an
129
+ environment file to be used with that build ( ` --environment=dev ` or ` --environment=prod ` ).
130
+ By default, the development build target and environment are used.
131
131
132
- At build time, ` src/environments/environment.ts ` will be replaced by
133
- ` src/environments/environment.NAME.ts ` where ` NAME ` is the argument
134
- provided to the ` --environment ` flag.
132
+ The mapping used to determine which environment file is used can be found in ` angular-cli.json ` :
133
+
134
+ ```
135
+ "environments": {
136
+ "source": "environments/environment.ts",
137
+ "dev": "environments/environment.ts",
138
+ "prod": "environments/environment.prod.ts"
139
+ }
140
+ ```
135
141
136
142
These options also apply to the serve command. If you do not pass a value for ` environment ` ,
137
143
it will default to ` dev ` for ` development ` and ` prod ` for ` production ` .
@@ -150,8 +156,8 @@ ng build
150
156
151
157
You can also add your own env files other than ` dev ` and ` prod ` by doing the following:
152
158
- create a ` src/environments/environment.NAME.ts `
153
- - add ` { NAME: 'src/environments/environment.NAME.ts' } ` to the the ` apps[0].environments ` object in ` angular-cli.json `
154
- - use them by using the ` --env=NAME ` flag on the build/serve commands.
159
+ - add ` { " NAME" : 'src/environments/environment.NAME.ts' } ` to the the ` apps[0].environments ` object in ` angular-cli.json `
160
+ - use them via the ` --env=NAME ` flag on the build/serve commands.
155
161
156
162
### Base tag handling in index.html
157
163
0 commit comments