“ ng build --prod”是否等效于“ ng build --aot --optimization --extractCss --extractLicenses --buildOptimizer”?

时间:2019-01-03 13:35:02

标签: angular

我已经为我的项目将构建配置定义到angular.json中,我想知道是否可以以显式方式复制默认的“ ng build --prod”。 这是我的配置:

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

这些选项产生的效果与“ ng build --prod”相同吗?

1 个答案:

答案 0 :(得分:1)

是的(来自默认的ng new项目):

       "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
        }