Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Angular 9: file replacements doesn't work

Angular fileReplacements doesn't replace files if they occur in assets. This code doesn't work in Angular 9 but works in version 8:

"assets": [
  "src/web.config"
]
...
"fileReplacements": [
  {
    "replace": "src/web.config",
    "with": "src/configs/web.stage.config"
  }
]

How can it be fixed?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You should copy assets using the assets property instead of file replacements.

This is a simplification of my angular.json file, showing only the relevant properties under configurations.

{  
  "projects": {
    "my-project": {      
      "architect": {
        "build": {          
          "configurations": {
            "staging": {
              "assets": [
                { "glob": "**/*", "input": "src/assets/", "output": "/assets/" },
                { "glob": "web.config", "input": "src/environments/staging/", "output": "/" }
              ],              
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ]
            },
            "production": {
              "assets": [
                { "glob": "**/*", "input": "src/assets/", "output": "/assets/" },
                { "glob": "web.config", "input": "src/environments/prod/", "output": "/" }
              ],            
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        }
      }
    }
  }
}

over 4 years ago · Santiago Trujillo Report

0

I had the same problem on angular 9 and downgrading "@angular-devkit/build-angular" from version ^0.1000.3 to ^0.900.7 did the trick

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!