Angular CLI + Angular 4 = IE10 不起作用 [英] Angular CLI + Angular 4 = IE10 doesn't work

查看:26
本文介绍了Angular CLI + Angular 4 = IE10 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让 IE10 加载全新的 Angular CLI 项目.除了运行ng new"时默认的 Angular CLI 包附带的代码外,没有其他代码.

I can't get IE10 to load a brand new Angular CLI project. There is no other code other than what comes with default Angular CLI package when you run 'ng new'.

我使用的是 Angular 4.2.4、@angular/cli 1.3.1 和 IE 10.0.9200.16519

I'm using Angular 4.2.4, @angular/cli 1.3.1 and IE 10.0.9200.16519

我尝试过 'ng build' 和 'ng build --prod' 并且都返回相同的错误消息.该项目在所有其他浏览器上运行.

I have tried 'ng build' and 'ng build --prod' and both return the same error messages. The project runs on every other browser.

我已经取消了在项目的 polyfills.ts 中运行 IE9、IE10、IE11 所需的所有 polyfill 行(并按照文件中的说明安装了所有内容)的注释.

I have uncommented all polyfill lines (and installed everything as per instructions in the file) that are needed to run IE9, IE10, IE11 in the polyfills.ts of the project.

这 4 个错误是:

预期标识符 polyfills.bundle.js,第 6127 行字符 67

var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;

对象不支持属性或方法'bind'styles.bundle.js,第279行字符3

update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);

预期标识符 vendor.bundle.js,第 2056 行字符 71

exports.rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
Symbol.for('rxSubscriber') : '@@rxSubscriber';

对象不支持属性或方法 'defineProperty' main.bundle.js,第 132 行字符 1

Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

似乎Symbol"、bind"和defineProperty"是罪魁祸首.

Seems like 'Symbol', 'bind', and 'defineProperty' are the culprits.

我确实看到在 pollyfills.ts 项目文件中包含 Symbol 和 Object es6 polyfill:

I do see Symbol and Object es6 polyfills being included in the pollyfills.ts project file though:

****************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
...
(+ all the other polyfills that are in the polyfills.ts file)

如何在 IE10 上实现这一点?

How do I get this going on IE10?

推荐答案

添加:

<meta http-equiv="x-ua-compatible" content="IE=edge">

到 index.html 的 部分.

to <head> section of index.html.

将 IE9、IE10、IE11 兼容模式设置为 EDGE 解决了所有问题.

Setting IE9,IE10,IE11 compatibility mode to EDGE fixed all the issues.

这篇关于Angular CLI + Angular 4 = IE10 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆