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

[Bug]: Silent fail when building results with incomplete build #19649

Open
gbkwiatt opened this issue Oct 27, 2022 · 1 comment
Open

[Bug]: Silent fail when building results with incomplete build #19649

gbkwiatt opened this issue Oct 27, 2022 · 1 comment

Comments

@gbkwiatt
Copy link

Describe the bug

In my case there was an issue with *.md being treated as mdx, so anything with { } and without backtick, was failing with Could not parse expression with acorn: Unexpected token

However whole build was not failing and completing with success. But as a result there was missing files in storybook-static output dir. ( missing iframe.html )

You can see those errors in logs from build, but it's very easy to miss, especially that build does not report error at all.

To Reproduce

Create mdx file that has incorrect text format inside.

System

No response

Additional context

No response

@JReinhold
Copy link
Contributor

I know you and I talked about this yesterday, but I'm actually unable to reproduce this in v7.0.0-alpha.45.

Adding {hello} to an mdx file will cause the doc to not render at all, but the build will work fine and produce an iframe.html

Adding {[key: string]: string} like I know you tried will make both dev and the build fail explicitly with a syntax error like

ERR! [12:6: Could not parse expression with acorn: Unexpected token] {
ERR!   reason: 'Could not parse expression with acorn: Unexpected token',
ERR!   line: 12,
ERR!   column: 6,
ERR!   source: 'micromark-extension-mdx-expression',
ERR!   ruleId: 'acorn',
ERR!   position: {
ERR!     start: { line: 12, column: 6, offset: 437 },
ERR!     end: { line: null, column: null }
ERR!   }
ERR! }                                      

The reason these two lines don't work is that MDX2 parses {...} as JavaScript, so {hello} will result in "hello is undefined" while {[key: string]: string} will result in an unexpected token.

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

No branches or pull requests

2 participants