Javascript Angualr 9-ng构建--prod创建了多个es5和es2015 js文件

Javascript Angualr 9-ng构建--prod创建了多个es5和es2015 js文件,javascript,angular,angular9,Javascript,Angular,Angular9,当我尝试构建angular应用程序时,我会将以下内容与主文件和其他必需文件一起作为捆绑包 0-es5.js 0-es2015.js 1-es5.js 1-es2015.js 4-es5.js 4-es2015.js 9-es5.js 9-es2015.js 10-es5.js 10-es2015.js 11-es5.js 11-es2015.js 12-es5.js 12-es2015.js 13-es5.js 13-es2015.js tsconfig.json { "compileOn

当我尝试构建angular应用程序时,我会将以下内容与主文件和其他必需文件一起作为捆绑包

0-es5.js
0-es2015.js
1-es5.js
1-es2015.js
4-es5.js
4-es2015.js
9-es5.js
9-es2015.js
10-es5.js
10-es2015.js
11-es5.js
11-es2015.js
12-es5.js
12-es2015.js
13-es5.js
13-es2015.js
tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "resolveJsonModule": true,
    "esModuleInterop": true
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

知道我为什么要得到多个es5和es2015文件吗?

自从Angular 8以来,您可以得到es2015和es5差异化的生产版本。根据加载应用程序的环境(即浏览器),其中一个应用程序会被加载,但不能同时加载两个应用程序

此功能旨在提供与旧版本浏览器更好的兼容性,而旧版本浏览器对ES2015没有很好的支持,例如Internet Explorer或first Edge版本


为了禁用此功能,您可以阅读相关的SO问题:

补充问题,如果使用延迟加载,请为每个延迟模块创建不同的.js(实际上是2,e5和e2015)