且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在生产模式下未填充角路由器出口

更新时间:2023-11-19 18:31:58

我遇到了同样的问题,不得不禁用aot并进行优化.我不知道为什么必须这样做,我认为它非常愚蠢,但这是我唯一的解决方案.

I hade the same issue and had to disable aot and build optimization. I dont know why this has to be done and I think its super stupid but it was the only solution for me.

您可以通过angular.json执行此操作.只需注释两个对应的条目:

You can do this via angular.json. Just comment the two corresponding entries:

  [...]
  "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "optimization": true,
          "outputHashing": "all",
          "sourceMap": false,
          "extractCss": true,
          "namedChunks": false,
          //"aot": true,
          "extractLicenses": true,
          "vendorChunk": false,
          //"buildOptimizer": true
        }
      }
    },
    [...]

或直接在命令行中

ng build --prod --build-optimizer=false --aot=false