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

The default export breaks if multiline #188

Closed
silvenon opened this issue Jul 15, 2018 · 1 comment
Closed

The default export breaks if multiline #188

silvenon opened this issue Jul 15, 2018 · 1 comment
Labels
🐛 type/bug This is a problem

Comments

@silvenon
Copy link
Contributor

The following MDX:

export default ({ children }) => (
  <Layout>
    {children}
  </Layout>
)

transpiles into broken JSX:

export default ({components}) => <MDXTag name="wrapper" Layout={({ children }) => (} components={components}>
  <Layout>
    {children}
  </Layout>
)</MDXTag>

because the default export is being added using line-by-line interpolation.

@ChristopherBiscardi
Copy link
Member

afaict, this is only the case for an mdx file without any content. While the first example here produces weird output, the second works just fine (codesandbox).

const t = mdx.sync(
  `export default ({ children }) => (
  <Layout>
    {children}
  </Layout>
)`
);
const t = mdx.sync(
  `export default ({ children }) => (
  <Layout>
    {children}
  </Layout>
)

some content`
);

@silvenon silvenon added the 🐛 type/bug This is a problem label Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 type/bug This is a problem
Development

No branches or pull requests

2 participants