You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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".
🐞 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.
The text was updated successfully, but these errors were encountered: