builder-vite: [Bug] 'mdx' is not exported by node_modules/@mdx-js/react/index.js

What version of vite are you using?

2.9.13

System info and storybook versions

Environment Info:

System: OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 LTS (Jammy Jellyfish) CPU: (8) x64 Intel® Core™ i7-2600 CPU @ 3.40GHz Binaries: Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node Yarn: 1.22.19 - /usr/bin/yarn npm: 8.13.1 - /media/fr/fr-work/Sites/dora/dora-front/node_modules/.bin/npm npmPackages: @storybook/addon-docs: ^6.5.9 => 6.5.9 @storybook/addon-essentials: ^6.5.9 => 6.5.9 @storybook/addon-links: ^6.5.9 => 6.5.9 @storybook/builder-vite: ^0.1.38 => 0.1.38 @storybook/mdx2-csf: ^0.0.3 => 0.0.3 @storybook/svelte: ^6.5.9 => 6.5.9

Describe the Bug

In a svelte project, there is the error : 'mdx' is not exported by node_modules/@mdx-js/react/index.js.

I installed @storybook/mdx2-csf and @mdx-js/react. (not sure if this is necessary)

Thank you

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

if I don’t install @mdx-js/react, there is this error:

[vite]: Rollup failed to resolve import "@mdx-js/react" from "src/Introduction.stories.mdx".

With the help of @IanVS , I managed to find two viable workarounds:

  • explicitely install react@^17 and react-dom@^17, or alternatively
  • update to the MDX2 preview and explicitely install @mdx-js/react@^2.