Description
Bug Report or Feature Request (mark with an x
)
- [ x ] bug report -> please search issues before submitting
- [ ] feature request
Area
- [ x ] devkit
- [ ] schematics
Versions
user@ux-machine:~/coding/angular/ang6test$ ng version
Angular CLI: 6.0.8
Node: 8.11.2
OS: linux x64
Angular: 6.0.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.0
typescript 2.7.2
webpack 4.8.3
npm --version
6.1.0
Repro steps
-
create a clear new project with:
ng new ang6test -
add two new configfiles like:
environments/environment.simpletest1.ts
( containing testvar: 'this is simpletest1')
environments/environment.simpletest2.ts
( containing testvar: 'this is simpletest2') -
declare configurations in angular.json like:
...
,
"simpletest1": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.simpletest1.ts"
}
]
},
"simpletest2": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.simpletest2.ts"
}
]
}
...
and also the serve-config:
...
"simpletest1": {
"browserTarget": "ang6test:build:simpletest1"
},
"simpletest2": {
"browserTarget": "ang6test:build:simpletest2"
}
... -
now just make it viewable like:
app.component.ts:
getTestValue() {
return environment.testvar;
}
app.component.html:{{getTestValue()}}
-
Now test it the following way:
5.1 start server with following command:
ng serve -c=simpletest1 -o
Browser opens with message 'this is simpletest1'
5.2 stop server and start again with:
ng serve -c=simpletest2 -o
Browser opens with message 'this is simpletest1'
See, what I mean? Should be simpletest2 in the second case!
The log given by the failure
No Error Thrown! Starting up normally:
user@ux-machine:~/coding/angular/ang6test$ ng serve -c=simpletest1 -o
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-06-09T19:25:09.546Z
Hash: c5c2444f0b09cdf5064f
Time: 8800ms
chunk {main} main.js, main.js.map (main) 9.97 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.3 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
^C
user@ux-machine:~/coding/angular/ang6test$ ng serve -c=simpletest2 -o
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-06-09T19:28:29.489Z
Hash: 0b7bafaf2dfd8831e6f0
Time: 8629ms
chunk {main} main.js, main.js.map (main) 9.97 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.3 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
Desired functionality
ng serve -c=configname
should just work as documented.
Mention any other details that might be useful
well, i tried and researched a lot for this. even this clean new project from the scratch makes it reproduceable.