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

Breakup array iterator files #670

Closed
ehmicky opened this issue Oct 15, 2019 · 2 comments
Closed

Breakup array iterator files #670

ehmicky opened this issue Oct 15, 2019 · 2 comments
Labels

Comments

@ehmicky
Copy link

ehmicky commented Oct 15, 2019

The following file:

[...array]

With the following .babelrc.js:

module.exports = {
  presets: [
    [
      '@babel/preset-env',
      { targets: { node: '9.11.2' }, useBuiltIns: 'usage', corejs: '3' },
    ],
  ],
}

Results in:

"use strict";

require("core-js/modules/es.array.iterator");

[...array];

core-js is included here but it is not necessary since the array spread operator is supported by Node 9.11.2. Note that this line is not added when targeting Node 10.0.0.

It seems to me the reason this file is included is because Array.values() was added by Node 10.0.0. However I am not using it in this case.

Using [email protected], @babel/[email protected], Ubuntu 19.10.

@zloirock
Copy link
Owner

It's how it works - we have compat data for es.array.iterator, but not for Array.prototype[@@iterator] (btw, here also some other issues). Most likely, it core-js@4 or after that, I'll split Array.prototype.{ @@iterator, keys, values, entries } to different modules and it will be solved.

@ehmicky
Copy link
Author

ehmicky commented Oct 15, 2019

Hi @zloirock, thanks for your quick answer.

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

No branches or pull requests

2 participants