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

Default export lost when using an arrow function containing a deconstructed object (T7531) #4430

Closed
babel-bot opened this issue Aug 2, 2016 · 1 comment
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@babel-bot
Copy link
Collaborator

Issue originally made by Ryan Duffy (ryan.duffy)

Bug information

  • Babel version: 6.11.4

Options

es2015 preset

Input code

export default () => ({
  x: ({x}) => {}
});

Description

With the above code, babel transpiles to a closure without module.exports. Seems to be unique to the combination of exporting an arrow function that returns an object containing a key whose value is an arrow function where the first arg is deconstructed with a key of the same name.

  • If the keys are different (x: ({y}) => {}) or the deconstructed key is renamed (e.g. x: ({x: y}) => {}), it doesn't reproduce.
  • If you use function in place of either arrow function, it doesn't reproduce.
  • If you store the closure into a local variable and then export that, it doesn't reproduce.

Reproducible via the babel repl as well

@danez
Copy link
Member

danez commented Sep 19, 2016

Thanks, duplicate of #4182.

@danez danez closed this as completed Sep 19, 2016
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

2 participants