-
Notifications
You must be signed in to change notification settings - Fork 12k
[Bug] fileReplacements configuration can not replace html files #10881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Confirmed. This doesn't work for me either:
However it still goes to look for the file, I noticed this because I misspelled 'some-other.html' and got the following error: |
FYI, this has been addressed and will be part of the 6.1 release. To look at that change, please refer to this PR: angular/devkit#887 |
Just for reference: angular/devkit#885 explains:
The above-mentioned angular/devkit#887 apparently fixes that; can't wait for 6.1 now ;-) (And indeed, for me |
|
|
Issue still happening in this version: "@angular/cli": "6.1.5". |
Issue still happening in this version: "@angular/cli": "6.1.5". "configurations": { UPDATE: fixed by updating @angular-devkit/build-angular as @suau suggested Thanks @suau |
@luillyfee @georgefam did you make sure you've updated |
@suau I can no longer reproduce this issue. Also I cannot remember how I did make it work, maybe is how you are pointing out. |
Any updates on this issue? Should it be fixed in 6.1.5? Im trying to replace a constants.scss (with constants.newconfig.scss) file that I import at the top of my root styles file. But none of the newconfig styles are pulling through. The strange thing is if I use this method with a component specific scss file it works perfectly. From what I can see its only with the root style files. Here's a stackoverflow link to my question. Im using 6.1.5 |
@developcodeza-matthew there is not link in your answer! |
@luillyfe My bad 🙈 Should be there now |
I'm facing the same issue with CLI 6.2.2 UPDATE: I fixed it by updating |
@iki789 You save my life . Thanks Bro. |
Is it possible to do dynamic file replacements? I'm trying to build two different UI's from the same App. So i have two different html files.
It's throwing me an error. Is this possible? |
using angular ^6.0.9 & angular/cli ^6.0.8, updated @angular-devkit/build-angular in devDependencies in package.json to ^0.8.9. seems to work as expected with environments and all |
with @angular/cli 7.3.0 html files are not replaced. |
Replacing html files is good feature to have. Very strange that the angular team hasn't addressed this issue. |
Has anyone got a fix for this yet? |
@AntonisFK @MattCMcNabb did you make sure yo update to the newest version as well ? works fine for me. |
@Jun711 |
I never had this problem, but since I updated my project to Angular 8, this is not working anymore. |
For later reference, in #14599, @clydin said:
See this ticket for temporary workarounds (disable es2015 targetting or rename index file after building). |
even .ts not worked for me
it prints the console.log of index.ts not dev.ts |
Can confirm this bug with Angular 8.1.3 (build-angular at 0.801.3). I've worked around it for now by having the following build script. I simply copy over the correct "build:stg": "ng build --configuration=staging && cp src/index.staging.html dist/index.html" |
also failed for me in version 8.0.1 |
Failed for me on build but works on serve. Config is:
Angular CLI: 8.0.3 Package Version@angular-devkit/architect 0.800.3 @angular-devkit/build-optimizer 0.800.3 |
@vaughnmuirhead Exact same case with me. |
how do the scripts get injected into the index staging? i have resorted to this should work in the azure pipeline
|
Can confirm it does not work yet in 0.803.2 Trying to reference the index directly (not replacing it) seems to be another solution meanwhile: |
This is working in my angular client but not in my angular universal ssr project. Not doing anything differently. |
This is still not replacing the index.html in the build. Can anyone tell me if I am using the file replacements correctly? |
@racerhere as stated above fileReplacements only works with certain filetypes. |
@mgechev Can you please reopen this bug so it will be priorities? |
I had the same issue. fortunately, our project only had 2 files for replacement so it was quite easy to change. so if previously the replacement was index.dev.html to index.html, the dist folder will only contain index.dev.html here's an example:
note the index property is referring to dev-index directory for dev configuration and to prod-index for prod configuration it's kind of messy because if you have more then 2 different index html files you might need a lot more directories but other than that it works for me with angular 8.2.4 |
The
Note that the schema used for IDE integration erroneously marks this as invalid (this will be corrected in the next patch release) but it can otherwise be safely used. |
See angular/angular-cli#10881 for discussion on replacing index files per-environment
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
Reproduce git: https://github.com/idododu/ng6-filereplacements-bug
fileReplacements
config inconfigurations
block ofangular.json
npm run project-b
to start dev serverObserved behavior
home-a.component.ts
was replaced correctly.home-a.component.ts
in chrome sourcehome-a.component.ts
in my source codehome-a.component.ts
was not replacedhome-a.component.html
in chrome sourcehome-a.component.html
in my source codehome-b.component.html
in my source codeDesired behavior
content of
home-a.component.html
should be replaced byhome-b.component.html
since i have configed inangular.json
Suppose we got two projects: Project A and Project B.
They share the most of my source codes except HomeComponent.
And I would like to put the codes in the same repo, and build different projects through
environments
configuration.Mention any other details that might be useful (optional)
Another point: can we support glob expressions in fileReplacements configuration?
The text was updated successfully, but these errors were encountered: