如何替换 angular.json 上的环境文件
how to replace environment file on angular.json
我正在寻找一种方法将 environment.test.ts 替换为 environment.ts
我曾经在 angular 9 中使用 fileReplacement,但在 angular.json 文件中使用 angular 11。这行不通。
"test": {
...
"fileReplacements": [
{
"replace": "src/index.html",
"with": "src/index.test.html"
},
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
]
},
所以我正在尝试这个但是我应该使用什么关键字来替换环境文件?
"test": {
...
"index":
{
"input": "src/index.test.html",
"output": "src/index.html"
},
"???": {
"input": "src/environments/environment.test.ts",
"output": "src/environments/environment.ts"
}
]
},
任何需要这个的人,这个有用。
"test": {
...
"index":
{
"input": "src/index.test.html",
"output": "index.html"
},
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}]
}
我正在寻找一种方法将 environment.test.ts 替换为 environment.ts 我曾经在 angular 9 中使用 fileReplacement,但在 angular.json 文件中使用 angular 11。这行不通。
"test": {
...
"fileReplacements": [
{
"replace": "src/index.html",
"with": "src/index.test.html"
},
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
]
},
所以我正在尝试这个但是我应该使用什么关键字来替换环境文件?
"test": {
...
"index":
{
"input": "src/index.test.html",
"output": "src/index.html"
},
"???": {
"input": "src/environments/environment.test.ts",
"output": "src/environments/environment.ts"
}
]
},
任何需要这个的人,这个有用。
"test": {
...
"index":
{
"input": "src/index.test.html",
"output": "index.html"
},
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}]
}