2017-09-04 32 views
16

角4的错误,我有角4项目,在Chrome成功的作品。 但是它不会对IE11加载在polyfills.bundle.js以下错误(我用命令“NG构建--env = PROD”建网站):在IE11

var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { 
    var iterFn = ITERATOR ? function() { return iterable; } : getIterFn(iterable); 
    var f = ctx(fn, that, entries ? 2 : 1); 
    var index = 0; 
    var length, step, iterator, result; 
    if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); 

iterFn是未定义这里这么错误被抛出。 请指教。

+1

也许状态,你添加/取消注释从polyfills.ts polyfills? –

+0

谢谢,Per。这真的是问题的根源。 – Sergey

回答

33

为了更好地支撑IE11的,你需要在你的polyfills专门添加一些ES6进口。列表如下:

/** 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'; 
+10

这可以通过注释掉所有在文件polyfills.ts中标记为IE9,IE10和IE11 polyfills的行来完成 –