wil
wil

Reputation: 903

how to replace environment file on angular.json

I am trying to find a way to replace environment.test.ts to environment.ts I used to use fileReplacement in angular 9 but with angular 11 in angular.json file. This doesn't work.

"test": { 
  ...
  "fileReplacements": [
    {
      "replace": "src/index.html",
      "with": "src/index.test.html"
    },
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.test.ts"
    }
  ]
},

So I am trying this but what keyword should I use to replace the environment file?

"test": {
  ...
  "index":  
    {
      "input": "src/index.test.html",
      "output": "src/index.html"
    },
  "???": {
      "input": "src/environments/environment.test.ts",
      "output": "src/environments/environment.ts"
    }  
  ]
},

Upvotes: 1

Views: 1279

Answers (1)

wil
wil

Reputation: 903

anyone who needs this, this works.

"test": {
  ...
  "index":  
    {
      "input": "src/index.test.html",
      "output": "index.html"
    },
  "fileReplacements": [{
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.test.ts"
   }]
}

Upvotes: 2

Related Questions