我们有一个带Angular 2的Asp.net MVC 5 Web应用程序
它支持Chrome / Firefox / Edge,但无法在IE 11中加载。它显示以下错误。
tsconfig :
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"types": []
},
"exclude": [
"node_modules",
"jspm_packages"
],
"compileOnSave": true
}
Layout.cshtml:
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="/node_modules/core-js/client/shim.min.js"></script>
<script src="/node_modules/zone.js/dist/zone.js"></script>
<script src="/node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="/systemjs.config.js"></script>
<script>
System.import('app').catch(function (err) { console.error(err); });
</script>
有没有办法让它在IE10 / IE11中运行???
答案 0 :(得分:1)
您用于编译器的target
版本正在生成IE不支持的代码(ES2015)。将其更改为旧版本。
答案 1 :(得分:1)
将tsConfig代码替换为下面的tsConfig代码
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"types": [],
"lib": [ "es2015", "es2017", "dom" ]
},
"exclude": [
"node_modules"
],
"compileOnSave": true
}