#Parse error starting with 7.0.0-beta.7

3 messages · Page 1 of 1 (latest)

short hearth
#

Heya! I'm working on upgrading our Storybook from 7.0.0-alpha.57 to 7.0.0-beta.50 and found the following issue:

10:14:55 PM [vite] Internal server error: Parse error @:330:18
  Plugin: storybook:inject-export-order-plugin
  File: /Users/emma/Code/Kitsu/web/src/components/Button/Button.stories.mdx
      at parse (/Users/emma/Code/Kitsu/web/node_modules/es-module-lexer/dist/lexer.cjs:1:402)
      at TransformContext.transform (/Users/emma/Code/Kitsu/web/node_modules/@storybook/builder-vite/dist/index.js:50:33)
      at Object.transform (file:///Users/emma/Code/Kitsu/web/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:40228:44)
      at async loadAndTransform (file:///Users/emma/Code/Kitsu/web/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36615:29) (x2)

I was able to bisect down to which release broke this, and it's specifically beta.7. I found a similar issue in discord search, but that was due to the .js extensions instead of .jsx -- since this is mdx I don't think that's the issue here.

The file (Button.stories.mdx) can be viewed here: https://github.com/hummingbird-me/kitsu-web/blob/react/src/components/Button/Button.stories.mdx

Perhaps notably the file is not 330 lines long, despite the parse error claiming to be on line 330 🤔

GitHub

:fire: Web app for Kitsu. Contribute to hummingbird-me/kitsu-web development by creating an account on GitHub.

mental lodge
#

That is very annoying, thanks for a detailed report!
On the surface your MDX file looks good, the only thing that looks odd is that you have an import statement that is not at the beginning of the file, I'm not sure that's valid in MDX2.

Could you try moving that line 168 to the top and see if that fixes the issue?

fading burrow
#

I also had a similar issue when running the tutorial on my work mac. It works fine on my windows box. When I run the tutorial from here: https://storybook.js.org/tutorials/intro-to-storybook/react/en/composite-component/#:~:text=decorators%3A [(story) %3D> <div style%3D{{ margin%3A '3rem' }}>{story()}</div>]%2C
I get this error:
2:06:29 PM [vite] Internal server error: Parse error @:8:23 ** Plugin: storybook:inject-export-order-plugin** File: /Users/a510523/work/react-sandbox/taskbox/src/components/TaskList.stories.js at parse (/Users/a510523/work/react-sandbox/taskbox/node_modules/es-module-lexer/dist/lexer.cjs:1:700) at TransformContext.transform (/Users/a510523/work/react-sandbox/taskbox/node_modules/@storybook/builder-vite/dist/index.js:1:7448) at Object.transform (file:///Users/a510523/work/react-sandbox/taskbox/node_modules/vite/dist/node/chunks/dep-BKbDVx1T.js:52312:62) at async loadAndTransform (file:///Users/a510523/work/react-sandbox/taskbox/node_modules/vite/dist/node/chunks/dep-BKbDVx1T.js:55067:29)

It seems similar to the issue you were having, did you ever resolve it?

Learn how to develop UIs with components and design systems. Our in-depth frontend guides are created by Storybook maintainers and peer-reviewed by the open source community.