繁体   English   中英

Angular 6 网站不能在 IE 上运行,但可以在所有浏览器上本地运行

[英]Angular 6 website not working on IE but works locally on all browsers

  • Angular 6 网站
  • VMware虚拟机环境
  • Windows Server 2012 R2 标准服务器

我的笔记本电脑上的 chrome 浏览器(所有版本)中有一个 angular 网站可以正常工作

  • 相同的角度网站在我的笔记本电脑(所有版本)中的 IE 中运行良好
  • 但是当我在客户端服务器、虚拟机、chrome 网站中部署它时工作正常
  • 但是IE网站为所有版本(数据中心的所有VM)提供白色空白页面
  • 控制台中没有错误也没有警告
  • 相关的 polyfills.ts 行未注释

我将 IE 的模式更改为兼容性并在控制台中观察到以下错误:

SCRIPT5009: 'Promise' is undefined
jspdf.min.js (118,654)
SCRIPT1002: Syntax error
main.js (8527,59)
SCRIPT5011: Can't execute code from a freed script
zone.js (2775,1)

要让 Angular App 在 IE 上运行,请转到 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/weak-map';
 import 'core-js/es6/set';

这是与 zone.js 和 IE 开发人员工具相关的已知错误。 https://github.com/angular/angular/issues/31723

开发解决方法是在加载 zone.js 之前添加此标志

(window as any).__Zone_enable_cross_context_check = true;
import 'zone.js/dist/zone';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM