ng2-angular.json与自定义打包

ng2-angular.json与自定义打包

吴阳 No Comment
Angular
"configurations": {
  "production": {
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "fileReplacements": [
      {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }
    ]
  },
  "tmp-prod-mode": {
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "fileReplacements": [
      {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }
    ]
  }
}

configurations节点中的两个属性使用方式,以下即为自定义配置打包命令。
其中 buildOptimizer=true,该优化命令会导致代码出现 l.ngOnDestory is not a function的问题。
以以下命令来避免。

ng build --c tmp-prod-mode

要发表评论,您必须先登录