Angular 6 for IE11 导致空白 window

Angular 6 for IE11 resulting in blank window

所以我正在处理的项目有一些问题——一切 运行 都很好,除了我试图取消注释 polyfill.ts 中用于 IE9、10 的导入语句和 11. 我已经取消注释所有内容和 运行 npm install --save classlist.js 和 npm install --save web-animations-js。一切都在 chrome 上构建并且 运行s 仍然在 chrome 上,但是在 IE11 上它仍然没有 运行,这种行为背后的任何想法?它在 IE11 上打开时带有 angular 徽标,但只是一个空白屏幕。

我错过了什么吗? 我已经在互联网上搜索过并与 gitter 交谈无济于事。

我找到了类似的帖子,但没有找到合适的答案。 (例如,Angular 5 doesn't work in IE9 "Internet Explorer cannot display the webpage"

找到其他帖子:
angular 5 application is working on edge but failing on ie11

还有

Angular 2 / 4 / 5 not working in IE11

尝试添加到 index.html: < meta http-equiv="X-UA-Compatible" content="IE=edge" />(添加 space 显示)

尝试添加到 index.html:

和 导入 'core-js/client/shim'; 至 polyfill.ts

Polyfill.ts:

import "core-js/es7/reflect";
import "zone.js/dist/zone";

/* IE9, IE10 and IE11 */
 import "core-js/es6/array";
 import "core-js/es6/date";
 import "core-js/es6/function";
 import "core-js/es6/map";
 import "core-js/es6/math";
 import "core-js/es6/number";
 import "core-js/es6/object";
 import "core-js/es6/parse-float";
 import "core-js/es6/parse-int";
 import "core-js/es6/regexp";
 import "core-js/es6/set";
 import "core-js/es6/string";
 import "core-js/es6/symbol";
 import "core-js/es6/weak-map";
/* IE10 and IE11 for NgClass support on SVG elements */
import "classlist.js";  // Run `npm install --save classlist.js`.

/*added for testing purposes, no positive result.*/
//import 'core-js/es7/reflect';
//import 'core-js/client/shim';

/* IE10 and IE11 for Reflect API. */
 import "core-js/es6/reflect";

/* Web Animations */
 import "web-animations-js";  // Run `npm install --save web-animations-js`.

还有: 已添加

<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>

给我的 index.html

为了解决这个问题,我:

1.  changed TSConfig to target ES5, and the module to es2015.
2.  I changed the order of the polyfills,
3.  I reran downloads for installing classlist.js and web-animations.js.
4.  and, I added:       < meta http-equiv="X-UA-Compatible" content="IE=edge">
to my html right below the meta tag <meta charset="utf-8">.

不确定这究竟是哪一部分解决了我的问题。我按照我认为影响结果的顺序排序了这个列表。

如果你用的是Angular v7.*.*,你可以按照[=中的polyfills.ts解决26=].ts 并遵循其内部提示,如下所示:

/** IE9, IE10, IE11, and Chrome <55 requires all of the following polyfills.
 *  This also includes Android Emulators with older versions of Chrome and Google Search/Googlebot
 */

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";

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import "classlist.js"; // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
import "core-js/es6/reflect";

您需要做的只是 取消注释 上面的行并安装下面的另一行:

npm install --save classlist.js

同样,ng serve您现在可以在 IE 11 中查看结果。