首页 > 解决方案 > ng build 不会将箭头函数转换为 es5

问题描述

我在 Angular 4 上有一个旧项目,这个项目需要与 IE11 兼容,所以我添加了所有需要 pollyfills 才能在 IE 上工作,我还将我的 tsconfig.ts 文件更改为:

  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "es6",
      "dom"
    ]
  }
}

但是当我使用ng build --prod, or时ng buildng build --prod --aot我的供应商文件仍然包含箭头函数。( =>)

标签: angulartranspiler

解决方案


推荐阅读