Angular 5 和 IE11 问题需要 IE 垫片

Angular 5 and IE11 problems that requires shims for IE

我正在使用 Angular 5 并试图在 IE11 中 运行 我的应用程序。我已取消注释 .\my-app\src\polyfills.ts 中的必要代码,但不幸的是,我在与此代码相关的 index.html 文件中收到以下错误:

<script>
  System.import('main.js').catch(function(err){ console.error(err); });
</script>

Error: 'System' is undefined

我环顾四周,发现了以下 Github 可能修复的问题:

https://github.com/angular/angular/issues/7144

在此线程中,它提到我需要在我的 index.html 文件中包含:

shims_for_IE.js

现在,我正在使用 Angular 5,但我不确定在哪里可以找到这个 shims_for_IE.js 文件,以便将它放在我的 index.html 文件中。

如何在 IE11 中解决这个 'System' is undefined 问题?

对于非 CLI

对于非 CLI 项目,在 index.html

中导入 shim.min.js
<script src="node_modules/core-js/client/shim.min.js"></script>

对于 CLI

在你的polyfills.ts中取消注释这些行

/***************************************************************************************************
 * BROWSER POLYFILLS
 */

/** IE9, IE10, IE11, and Chrome <55 requires all of the following polyfills.    

import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

如前所述在 index.html 文件中添加此元标记 here

 <meta http-equiv="X-UA-Compatible" content="IE=edge" />