角fileReplacements
如果它们出现在不替换文件assets
。此代码不适用于 Angular 9,但适用于版本 8:
"assets": [
"src/web.config"
]
...
"fileReplacements": [
{
"replace": "src/web.config",
"with": "src/configs/web.stage.config"
}
]
Run Code Online (Sandbox Code Playgroud)
如何修复?
Kur*_*ton 13
您应该使用 assets 属性而不是文件替换来复制资产。
这是我的angular.json
文件的简化,仅显示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"
}
]
}
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5640 次 |
最近记录: |