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 not found when exporting as object literal #54

Closed
santiagoaguiar opened this issue Oct 15, 2015 · 6 comments
Closed

Default export not found when exporting as object literal #54

santiagoaguiar opened this issue Oct 15, 2015 · 6 comments

Comments

@santiagoaguiar
Copy link

I'm using the following syntax:

export { 
    foo as default,
    bar
}

And later importing as:

import foo, { bar } from "foo";

But I'm getting a 'No default export found in module'. Code runs and compiles fine with babel.

Switching the foo module to:

export const bar = ..;
export default foo;

Works OK.

Using 0.8.0, with babel-eslint 1.4.3 as parser.

@benmosher
Copy link
Member

Fascinating. I have never run into this syntax. Esprima is cool with it too.

I would have thought this was invalid, but given the spec on exports, seems like this is a normal case. Not without precedent, either.

I'm not totally clear on whether this is valid per the spec (Babel allows a lot of things), but it certainly seems useful.

I'm not sure what to do... seems like the pragmatic thing is to handle it as you've described.

@benmosher
Copy link
Member

Probing the net with this StackOverflow post, too.

@santiagoaguiar
Copy link
Author

I think it should be accepted according to http://www.ecma-international.org/ecma-262/6.0/#table-42.

@benmosher
Copy link
Member

Yeah, between that and table 40, I think you're right. I will handle. 😁👍

@benmosher
Copy link
Member

Let me vet the changes a little tomorrow at work, and then I will publish as 0.8.1. Thanks for the report!

@santiagoaguiar
Copy link
Author

Amazing!! Thanks a lot for that prompt reply :).

I used the new version and it worked great for me.

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

No branches or pull requests

2 participants