IE11 中的 Angular4 应用程序 运行 问题
Angular4 Application running issues in IE11
我正在使用 Angular CLI (1.1.2) 构建一个 Angular4 项目。它在 Chrome(版本 59.0.3071.115)和 firefox(54.0.1)中完美运行,但是当我尝试使用 IE11(Verison 11.0.9600.18738)时,什么也没有出现,当我在 IE 中打开开发者模式时,它显示我出现以下错误:
SCRIPT5022: Exception thrown and not caught
File: polyfills.bundle.js, Line: 829, Column: 34
详细错误信息如下:
有人知道如何解决这个问题吗?
谢谢!
默认polyfills.ts文件被注释,需要取消注释代码行和运行npm安装相应的模块。那么它将兼容IE11
为@Zeqing的回答添加更多细节。
我取消注释了 .\my-app\src\polyfills.ts
中的以下代码行:
/** IE9, IE10 and IE11 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/set';
我在尝试添加 es7 导入时得到了这个。我只是用 es7 导入替换了 es6 导入。结果我两者都需要。
给我 "Exception thrown and not caught" 错误:
import 'core-js/es7/array';
工作正常:
import 'core-js/es6/array';
import 'core-js/es7/array';
我正在使用 Angular CLI (1.1.2) 构建一个 Angular4 项目。它在 Chrome(版本 59.0.3071.115)和 firefox(54.0.1)中完美运行,但是当我尝试使用 IE11(Verison 11.0.9600.18738)时,什么也没有出现,当我在 IE 中打开开发者模式时,它显示我出现以下错误:
SCRIPT5022: Exception thrown and not caught
File: polyfills.bundle.js, Line: 829, Column: 34
详细错误信息如下:
有人知道如何解决这个问题吗?
谢谢!
默认polyfills.ts文件被注释,需要取消注释代码行和运行npm安装相应的模块。那么它将兼容IE11
为@Zeqing的回答添加更多细节。
我取消注释了 .\my-app\src\polyfills.ts
中的以下代码行:
/** IE9, IE10 and IE11 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/set';
我在尝试添加 es7 导入时得到了这个。我只是用 es7 导入替换了 es6 导入。结果我两者都需要。
给我 "Exception thrown and not caught" 错误:
import 'core-js/es7/array';
工作正常:
import 'core-js/es6/array';
import 'core-js/es7/array';