简体   繁体   English

如何更换 angular.json 上的环境文件

[英]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. 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"
    }  
  ]
},

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"
   }]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM