🐞 Bug report
- [ ] new
- [x] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
I recall this working prior to upgrading to v8.
Description
The section "fileReplacements" in "angular.json" works for "ng serve" and "ng serve --prod" but not for "ng build --prod".
🔬 Minimal Reproduction
Clone the repro app. There are two sets of files to observe:
- environment.ts and environment.prod.ts
- index.html and index.prod.html
File "angular.json" has the appropriate "fileReplacements" for production build for the two sets of files. The HTML files differ in the <h1> tag which clearly indicates development/production. Also, the AppComponent merely reflects "environment.production".
- Run the app with "ng serve", both
<h1> and AppComponent show "development" as expected.
- Run the app with "ng serve --prod", both
<h1> and AppComponent show "production" as expected.
- Run the app with "ng build --prod" and run the app using e.g. "serve", the
<h1> shows "development" while AppComponent shows "production". Clearly not as expected. Inspecting generated "dist/index.html" shows that the file was NOT replaced.
🔥 Exception or Error
There is no error. If this feature is not supported as some people have indicated in issue #10881, then there should definitely be an error during build that the files are skipped/ignored. There is no indication that the HTML files are skipped.
It is strange that "ng serve --prod" behaves differently to "ng build --prod".
🌍 Your Environment
Angular CLI: 8.0.6
Node: 10.16.0
OS: win32 x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.6
@angular-devkit/build-angular 0.800.6
@angular-devkit/build-optimizer 0.800.6
@angular-devkit/build-webpack 0.800.6
@angular-devkit/core 8.0.6
@angular-devkit/schematics 8.0.6
@angular/cli 8.0.6
@ngtools/webpack 8.0.6
@schematics/angular 8.0.6
@schematics/update 0.800.6
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Anything else relevant?
I have tried running "ng update" to get the latest and greatest but it did not work either.
🐞 Bug report
Is this a regression?
I recall this working prior to upgrading to v8.
Description
The section "fileReplacements" in "angular.json" works for "ng serve" and "ng serve --prod" but not for "ng build --prod".
🔬 Minimal Reproduction
Clone the repro app. There are two sets of files to observe:
File "angular.json" has the appropriate "fileReplacements" for production build for the two sets of files. The HTML files differ in the
<h1>tag which clearly indicates development/production. Also, the AppComponent merely reflects "environment.production".<h1>and AppComponent show "development" as expected.<h1>and AppComponent show "production" as expected.<h1>shows "development" while AppComponent shows "production". Clearly not as expected. Inspecting generated "dist/index.html" shows that the file was NOT replaced.🔥 Exception or Error
There is no error. If this feature is not supported as some people have indicated in issue #10881, then there should definitely be an error during build that the files are skipped/ignored. There is no indication that the HTML files are skipped.
It is strange that "ng serve --prod" behaves differently to "ng build --prod".
🌍 Your Environment
Anything else relevant?
I have tried running "ng update" to get the latest and greatest but it did not work either.