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

Spread transformation requires Symbol.iterator now #9277

Open
clshortfuse opened this Issue Jan 3, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@clshortfuse
Copy link

clshortfuse commented Jan 3, 2019

v7 Regression

Potential Commit/PR that introduced the regression

4da3f3b

Describe the regression

Transformation of Spread now requires Symbol

Input Code

const divElements = [...document.getElementsByTagName('div')];

Babel Configuration (.babelrc, package.json, cli command)

// from webpack:

module: {
  rules: [{
    test: /\.js$/,
    exclude: /(node_modules|bower_components)/,
    use: {
      loader: 'babel-loader',
      options: {
        presets: [
          ['@babel/preset-env'],
        ],
      },
    },
  }
}

Expected behavior/code

Before this commit, all you needed was a polyfill for Array.from(). Now Symbol.iterator is needed as well. This breaks IE11.

Environment

  • Babel version(s): @babel/preset-env: 7.2.3,
  • Node/npm version: 8.11.3 / 6.5.0
  • OS: OSX 10.14.2
  • Monorepo: ??
  • How you are using Babel: webpack

If, for some reason we still need Symbol.iterator, perhaps we perform the isIterable check AFTER the prototype check for [object Arguments]. That way, requiring Symbol.iterator would be a last-ditch effort.

@babel-bot

This comment has been minimized.

Copy link
Collaborator

babel-bot commented Jan 3, 2019

Hey @clshortfuse! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

nicolo-ribaudo commented Jan 7, 2019

Thank you for the bug report! We are tracking it at #7597, and there is a PR at #8947.

@clshortfuse

This comment has been minimized.

Copy link

clshortfuse commented Jan 7, 2019

@nicolo-ribaudo I'm not sure this is the same issue, or perhaps I'm just being too specific. #7597 targets Symbol entirely, which would also remove caveats for Array destructuring and Array For Ofas listed in https://babeljs.io/docs/en/caveats . That would fall more into a "nice-to-have" category, while this is an actual regression for Spread.

This is just talking about the regression in Spread specifically. If anything, I would say PR #8947 would fix this issue as well as #7597.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

nicolo-ribaudo commented Jan 7, 2019

I can leave this open if you prefer, just in case someone else has the same problem to avoid another issue.

@nicolo-ribaudo nicolo-ribaudo reopened this Jan 7, 2019

iezer added a commit to bustle/mobiledoc-kit that referenced this issue Jan 10, 2019

Remove spread argument that is causing IE11 test failure
 Getting this issue: babel/babel#9277
 Which may be fixed when this PR is merged: babel/babel#8947

iezer added a commit to bustle/mobiledoc-kit that referenced this issue Jan 10, 2019

Remove spread argument that is causing IE11 test failure
 Getting this issue: babel/babel#9277
 Which may be fixed when this PR is merged: babel/babel#8947
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment