Angular error 4 in IE11

I have an Angular 4 project that works successfully in Chrome. However, it does not load on IE11 with the following error in polyfills.bundle.js (I use the "ng build --env = prod" command to build the 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 an error occurs. Please inform.

+26
source share
3 answers

For better IE11 support, you need to add some imported es6 products exclusively to your policies. The 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';
+49
source

Since @Sumit answered, you need to add these imports to the polyfill.ts file:

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';

In addition, you need to import the reflection API:

/** IE10 and IE11 requires the following for the Reflect API. */

 import 'core-js/es6/reflect';

/** Evergreen browsers require these. **/

// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators),you 
//can remove.

import 'core-js/es7/reflect';

, Angular , -, IE.

import 'web-animations-js';  // Run 'npm install --save web-animations-js'.

, Angular- IE:

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import 'classlist.js';  // Run 'npm install --save classlist.js'

,

+2

I had the same error and the array class was needed for this particular error. In order to make my libraries smaller, I just imported an array class. After that, I got another error that required the use of the string class, which is often used, so I would start by listing these two. I am a little minimalist, so I did not want to bring others until needed.

import 'core-js/es6/array';
import 'core-js/es6/string';
0
source

Source: https://habr.com/ru/post/1685920/


All Articles