I have Angular 4 project that works successfully on Chrome. However it doesn't load on IE11 with the following error in polyfills.bundle.js(I use command "ng build --env=prod" to build site):
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 is undefined here so error is thrown. Please advise.
By default, Angular compiles ES6 or ES7. IE 11 only supports ES5.
The reason for this error was IE was running in compatibility mode and in that mode it's running with older version of JavaScript which does not support “querySelector.”. In order to fix the issue: Simply turn off the compatibility mode in IE and you should be good to go !
As you can see, to support IE 11, you need to add es5BrowserSupport property in angular. json file and change the target as es5 in tsconfig. json file that solved the problem. Let me know in the comments if you have questions.
For better support of IE11 you need to add some es6 imports exclusively in your polyfills. List is as follows:
/** 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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With