Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE11 with Promise.all() #211

Closed
andersekdahl opened this issue Jun 13, 2016 · 2 comments
Closed

IE11 with Promise.all() #211

andersekdahl opened this issue Jun 13, 2016 · 2 comments

Comments

@andersekdahl
Copy link

Running this code in the console in IE11:

Promise.all([new Promise(function (resolve) {resolve()})])

Gives me the following error:

[object Object] is not iterable!

at module.exports (https://xxx/assets/bundle.js:2904:35)
at Anonymous function (https://xxx/assets/bundle.js:2812:8)
at perform (https://xxx/assets/bundle.js:2602:6)
at all (https://xxx/assets/bundle.js:2808:6)
at eval code (eval code:1:1)
at Global code (Unknown script code:5:1)

We use Webpack and I've looked at this issue #77 but I don't think it's the same thing. We get the same error even when not using Webpacks devtool option.

I get the error when the polyfill for Promise.all calls forOf from _for-of.js with an array as the first argument and var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable) returns undefined. I stepped through getIterFn (core.get-iterator-method.js) and classof(it) is Array but Iterators is an empty object which produces the error.

We import the polyfills one by one for the ones we need like this:

import 'core-js/es5';
import 'core-js/modules/es6.promise';
import 'core-js/modules/es6.array.find';
import 'core-js/modules/es6.array.find-index';
import 'core-js/modules/es7.array.includes';
import 'core-js/modules/es6.string.ends-with';
import 'core-js/modules/es6.string.starts-with';
import 'core-js/modules/es7.string.pad-end';
import 'core-js/modules/es7.string.pad-start';
import 'core-js/modules/es6.string.trim';
import 'core-js/modules/es6.string.includes';
import 'core-js/modules/es7.string.trim-left';
import 'core-js/modules/es7.string.trim-right';

Could it be that we're missing some polyfill that's required for it to work?

This seems to be a minimal reproduce test:

var forOf = require('core-js/modules/_for-of');
const x = [1, 2, 3];
forOf(x, false, (y) => {
  console.log(y);
});

The same error is thrown in IE11 but no errors in latest Firefox or Chrome.

@zloirock
Copy link
Owner

It's this case. core-js/modules path - internal API, if you not completely sure what are you doing - use core-js/fn path.

@andersekdahl
Copy link
Author

Thanks for the fast reply, changing to the fn path solved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants