json 如何将配置文件替换为Angular 13?

hjzp0vay  于 2023-04-08  发布在  Angular
关注(0)|答案(1)|浏览(127)

我得到的错误是:

Schema validation failed with the following errors:
  Data path "/fileReplacements/1" must have required property 'src'.
  Data path "/fileReplacements/1/replace" must match pattern "\.(([cm]?j|t)sx?|json)$".
  Data path "/fileReplacements/1" must match exactly one schema in oneOf.

My angular.json:

...
"production": {
    "fileReplacements": [
    {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
    },
    {
        "replace": "src/web.config",
        "with": "src/web.prod.config"
    }]
...
}

我升级到了Angular 13,现在我在尝试使用这个命令构建一个prod版本时遇到了一个错误:ng构建--生产
我该怎么办?这是Angular 13的bug吗?我应该使用不同的方法吗?
任何帮助将不胜感激。

vbkedwbf

vbkedwbf1#

我修好了:

...
"production": {
    "fileReplacements": [
    {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
    },
    "assets": [
        "src/web.config",
        {
            "glob": "web.config",
            "input": "src/iis/prod/",
            "output": "./"
        }]
...
}

相关问题