2017-09-04 35 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的行來完成 –