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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: rest spread data is lost when @babel/plugin-transform-computed-properties is used alone #16233

Open
1 task
hubgit opened this issue Jan 24, 2024 · 1 comment
Labels

Comments

@hubgit
Copy link

hubgit commented Jan 24, 2024

馃捇

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

REPL

const first = {
  b: 'b',
}

const second = {
  ...first,
  a: 'a',
  ['c']: 'c'
}

Configuration file name

No response

Configuration

No response

Current and expected behavior

When an object contains both a rest spread and a computed property name, and @babel/plugin-transform-computed-properties is used without @babel/plugin-transform-object-rest-spread, the rest spread data is missing from the transformed code.

Given the input code above, I would expect the output to be this:

const second = _defineProperty({
  ...first,
  a: 'a'
}, 'c', 'c');

rather than the current output:

const second = _defineProperty({
  a: 'a'
}, 'c', 'c');

Environment

  • Babel version 7.23.8

Possible solution

No response

Additional context

This was discovered when using @babel/preset-env with @babel/plugin-transform-object-rest-spread excluded.

@babel-bot
Copy link
Collaborator

Hey @hubgit! 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.

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

3 participants