Mdx: export default Layout; (with semicolon)

Created on 26 Sep 2018  路  6Comments  路  Source: mdx-js/mdx

Hi, I noticed that the mdx examples don't use semicolons, are they valid?

Because export default Layout; is failing:

mdx.sync(`
import Layout from './Layout';

export default Layout;

# Hello, world!
`)

returns:

import Layout from './Layout';

export default ({components, ...props}) => <MDXTag name="wrapper" Layout={Layout;} layoutProps={props} components={components}>

<MDXTag name="h1" components={components}>{`Hello, world!`}</MDXTag></MDXTag>

(see Layout={Layout;})

馃 typenhancement

Most helpful comment

Released in v0.15.6! It turned out to be an easy fix.

All 6 comments

We should either start supporting semicolons or explicitly prohibit them.

In feel like it should be supported 馃憤

Hey there 馃憢

I just spent a couple of hours trying to understand why my default export wrapper wasn't working.

Turns out it was also because I was using semi colon.

I agree with @silvenon that semi colons should be either supported or prohibited.

I'd personally prefer if it was supported 馃憤

Me too! Prohibiting them would be such a confusing limitation. I'm currently a bit burned out from solving deeper parsing issues, so it will take me awhile to add support for this, unless someone else beats me to it. 馃槈

Totally understandable! No pressure. I'm not sure I can help add support to this, it's probably above me. But I can update the docs with a note!

Released in v0.15.6! It turned out to be an easy fix.

Was this page helpful?
0 / 5 - 0 ratings