-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Export syntax creates duplicate default exports #205
Comments
Just to expand upon this a bit. The code snippet above is a way to make a default export using named exports. There are other variants of this, like: // exporting directly from a module
export { Layout as default } from './components' // exporting a variable
import Layout from './components'
export { Layout as default } // bundled with other exports
export { Layout as default, meta } from './post-components' etc. AFAICT, this isn't a simple regex fix because we need convert things like this: export { default } from './Layout' into something like this: import Layout from './Layout'
export default ({ components, ...props }) =>
<MDXTag name="wrapper" layout={Layout} ... which means that we need to pick a name which doesn't collide with existing variable names etc. I think we need to bring in Babel parser for this. |
I'm strongly against bringing Babel into mdx to solve just one issue. |
As a maintainer I'm against it as well, but I can see why people would expect this to work. I can submit a PR which raises an error upon encountering this syntax. |
I agree with keeping Babel out of mdx. I mostly just wanted to share that I noticed that that particular syntax doesn't seem to work |
Using the following syntax for layouts causes a syntax error (
SyntaxError: Only one default export allowed per module.
):The text was updated successfully, but these errors were encountered: