用最少的文件数进行Angular ng构建? (仅支持Chrome也可以)

时间:2019-06-05 16:17:28

标签: angular angular-cli angular8

建立棱角项目时,我看到

main-es5.jsmain-es2015.js这两个文件。我只想仅支持Chrome浏览器,如何关闭构建旧的js文件,我希望在Build上保留最少的文件数。

自升级到8版以来,我的版本也运行了两次

注意

  

构建时间已大大增加,我得到警告警告   在预算中,超出了初始预算的上限。

这是我的 Angular.json 文件

      "optimization": true,
      "outputHashing": "none",
      "sourceMap": true,
      "extractCss": false,
      "namedChunks": false,
      "showCircularDependencies": false,
      "aot": true,
      "extractLicenses": false,
      "statsJson": false,
      "progress": true,
      "vendorChunk": false,
      "buildOptimizer": true,

浏览器列表文件

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
#   npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

编辑:在Github

上提出了功能请求

2 个答案:

答案 0 :(得分:1)

在tsconfig.json中有一个目标:“ es2015”将目标更改为“ es5”,您将获得类似于angular 7应用程序的构建。

答案 1 :(得分:0)

根据@clydinGitHub的评论

浏览器列表

# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
#   npx browserslist
Chrome 70

仅创建最小的Chrome版本ES2015 +版本