Storybook: Module build failed (from ./node_modules/@mdx-js/loader/index.js)

Created on 1 Sep 2019  路  4Comments  路  Source: storybookjs/storybook

Describe the bug
Everything worked fine until in and MDX file I've added a new story.
In other MDX files stories work fine.

The error message is:

Module build failed (from ./node_modules/@mdx-js/loader/index.js):
SyntaxError: Unexpected token (1:62)
    at Object.raise (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:6325:17)
    at Object.unexpected (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:7642:16)
    at Object.getExpression (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:8125:12)
    at Object.parseExpression (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/node_modules/@babel/parser/lib/index.js:11316:17)
    at getExports (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:257:26)
    at /home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:304:19
    at Array.forEach ()
    at extractExports (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:303:17)
    at Compiler (/home/cs/work/react-best-practices/node_modules/@storybook/addon-docs/dist/mdx/mdx-compiler-plugin.js:364:14)
    at Function.stringify (/home/cs/work/react-best-practices/node_modules/unified/index.js:344:12)
    at pipelineStringify (/home/cs/work/react-best-practices/node_modules/unified/index.js:40:25)
    at wrapped (/home/cs/work/react-best-practices/node_modules/trough/wrap.js:25:19)
    at next (/home/cs/work/react-best-practices/node_modules/trough/index.js:57:24)
    at done (/home/cs/work/react-best-practices/node_modules/trough/wrap.js:55:16)
    at done (/home/cs/work/react-best-practices/node_modules/unified/index.js:34:7)
    at done (/home/cs/work/react-best-practices/node_modules/unified/index.js:304:11)

./src/components/ThinkingInReact/ThinkingInReact.stories.mdx@http://localhost:9009/main.0bbc0897561a87b9ac64.bundle.js:7044:7
__webpack_require__@http://localhost:9009/runtime~main.0bbc0897561a87b9ac64.bundle.js:786:30
fn@http://localhost:9009/runtime~main.0bbc0897561a87b9ac64.bundle.js:151:20
webpackContext@http://localhost:9009/main.0bbc0897561a87b9ac64.bundle.js:41:9
loadStories/

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/metamn/react-best-practices/releases/tag/v0.0.2
  2. Download the release frozen to keep the bug
  3. Install locally and run storybook
  4. See error

Expected behavior
It should display the new story as the other stories in the past

Screenshots
Screenshot from 2019-09-01 13-42-33

Code snippets
This is the component: src/components/ThinkingInReact/ThinkingInReact.js
This is the MDX file: src/components/ThinkingInReact/ThinkingInReact.stories.mdx
This is the story:

<Preview>
  <Story name="Pure component">
    <PureComponent param1="String" param2={true} />
  </Story>
</Preview>

System:

Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i5-7Y54 CPU @ 1.20GHz
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    Yarn: 1.9.4 - /usr/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 70.0.3538.77
    Firefox: 68.0.2
  npmPackages:
    @storybook/addon-actions: ^5.2.0-rc.2 => 5.2.0-rc.2 
    @storybook/addon-docs: ^5.2.0-rc.2 => 5.2.0-rc.2 
    @storybook/addon-links: ^5.2.0-rc.2 => 5.2.0-rc.2 
    @storybook/addons: ^5.2.0-rc.2 => 5.2.0-rc.2 
    @storybook/react: ^5.2.0-rc.2 => 5.2.0-rc.2 
    @storybook/storybook-deployer: ^2.8.1 => 2.8.1 

Additional context
Add any other context about the problem here.

inactive mdx question / support

Most helpful comment

Do you need to set configureJsx: true in the preset?

https://github.com/storybookjs/storybook/blob/master/addons/docs/README.md#preset-options

All 4 comments

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Do you need to set configureJsx: true in the preset?

https://github.com/storybookjs/storybook/blob/master/addons/docs/README.md#preset-options

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wahengchang picture wahengchang  路  3Comments

zvictor picture zvictor  路  3Comments

alexanbj picture alexanbj  路  3Comments

rpersaud picture rpersaud  路  3Comments

levithomason picture levithomason  路  3Comments