我试图让我的代码在 IE11 上运行,但是,我遇到了箭头函数的问题。我不知道如何从构建中删除它们并用 function() {}
替换它们。
看起来它们已从我的 main.js
中删除,但在 vendor.js
文件中,箭头函数仍然存在。我怎样才能删除它们?
我有一个如下所示的浏览器列表:
> 0.5%
last 2 versions
Firefox ESR
not dead
IE 9-11
我还有一个如下所示的 tsconfig.json
:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"downlevelIteration": true,
"importHelpers": true,
"outDir": "../path/to/folder",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
最佳答案
您可以在 tsconfig.json< 中使用
指定要编译的文件。我很确定默认情况下它不会触及 "files"
、"include"
和 "exclude"
属性.js
文件。
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#examples
https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#details
关于javascript - Angular CLI 删除箭头函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59060433/