Skip to content

File Replacements Not Applied in RC.6 #16439

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

Closed
1 of 15 tasks
markheron91 opened this issue Dec 13, 2019 · 4 comments
Closed
1 of 15 tasks

File Replacements Not Applied in RC.6 #16439

markheron91 opened this issue Dec 13, 2019 · 4 comments

Comments

@markheron91
Copy link

markheron91 commented Dec 13, 2019

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, it worked fine in RC.4

Description

I recently updated my project from CLI 9.0.0-rc.4 to 9.0.0-rc.6. After upgrading, my file replacements of environment files are no longer working.

I use a json file in the assets folder to store my environment variables, which is populated at build with different values depending on my build configuration.

Now, instead of filling the file in with the values from the replacement file, nothing happens and the original json file from the assets/ folder is built.

🔬 Minimal Reproduction

Clone the repo: https://github.com/markheron91/TestAngularCLIRC6FileReplacements.git

ng build --configuration=local
ng build --configuration=production

🔥 Exception or Error

Notice that the default environment.json file with the blank url is included in the built code, not either of the replacement files that should have overwritten it.

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.0-rc.6
Node: 12.13.1
OS: win32 x64

Angular: 9.0.0-rc.6
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.6
@angular-devkit/build-angular     0.900.0-rc.6
@angular-devkit/build-optimizer   0.900.0-rc.6
@angular-devkit/build-webpack     0.900.0-rc.6
@angular-devkit/core              9.0.0-rc.6
@angular-devkit/schematics        9.0.0-rc.6
@ngtools/webpack                  9.0.0-rc.6
@schematics/angular               9.0.0-rc.6
@schematics/update                0.900.0-rc.6
rxjs                              6.4.0
typescript                        3.6.4
webpack                           4.41.2

Anything else relevant?

N/A

@alan-agius4
Copy link
Collaborator

Hi @markheron91, File replacements is really meant to alter compilation and not asset files.

@clydin
Copy link
Member

clydin commented Dec 13, 2019

As mentioned, the file replacements option is intended to replace individual files that are bundled within the output Javascript files (main, vendor, polyfills, etc.) during compilation. The configuration as shown in the example project was never intended to be used (or even work) in that way. The asset configuration can be controlled directly within individual configurations and is the officially supported method to accomplish these type of use cases.

@markheron91
Copy link
Author

@alan-agius4 @clydin Thanks for the response - I had moved from the individual configurations as I was forced to support runtime environment configuration, but there are other ways for me to do this that do not rely on the behaviour that I was seeing previously in fileReplacements.

I'll close this issue.

Thanks! 😄

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants