[英]Angular 2 not loading in IE 11
我們有一個帶有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中工作?
您用於編譯器的target
版本正在生成IE(ES2015)不支持的代碼。 將其更改為舊版本。
用下面的代碼替換您的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
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.