question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@mdx-js_react.js does not provide an export named 'mdx' [Bug]

See original GitHub issue

What version of vite are you using?

2.9.9

System info and storybook versions

Environment Info:

System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 3.2.0 - /usr/local/bin/yarn npm: 8.6.0 - /usr/local/bin/npm Browsers: Chrome: 101.0.4951.64 Edge: 101.0.1210.53 Firefox: 97.0.1 Safari: 13.1.2 NPM Packages

“dependencies”: { “vue”: “^3.2.25” }, “devDependencies”: { “@babel/core”: “^7.18.2”, “@mdx-js/react”: “^2.1.1”, “@storybook/addon-actions”: “^6.5.6”, “@storybook/addon-essentials”: “^6.5.6”, “@storybook/addon-interactions”: “^6.5.6”, “@storybook/addon-links”: “^6.5.6”, “@storybook/addon-postcss”: “^2.0.0”, “@storybook/builder-vite”: “^0.1.35”, “@storybook/testing-library”: “^0.0.11”, “@storybook/vue3”: “^6.5.6”, “@tailwindcss/forms”: “^0.5.2”, “@vitejs/plugin-vue”: “^2.3.3”, “autoprefixer”: “^10.4.7”, “babel-loader”: “^8.2.5”, “postcss”: “^8.4.14”, “tailwindcss”: “^3.0.24”, “vite”: “^2.9.9”, “vue-loader”: “^16.8.3” }

Describe the Bug

MDX files throw the following error in Storybook:

SyntaxError: The requested module '/node_modules/.vite-storybook/deps/@mdx-js_react.js?v=4345b16f' does not provide an export named 'mdx'

I am using Storybook inside an NPM workspace / Monorepo. If I install Storybook into a fresh project (outside the monorepo) I do not have this issue.

Any ideas?

Link to Minimal Reproducible Example

No response

Participation

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
hsheikhali1commented, Jul 4, 2022

Sorry to reopen this issue but I’m getting this error and I’m using react v17 in my pnpm monorepo… I can’t get mdx to work with storybook…

5reactions
IanVScommented, May 31, 2022

Interesting. I think you can work around this for now with npm i --save-dev @mdx-js/react@1 --force.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting MDX
The reason for this error is that the parser is expecting a JavaScript import or export statement. If you want the word import...
Read more >
vite the requested module does not provide an export named ...
The reason it didn't work is that Vue provides a named export, whereas you are trying to import it as though it had...
Read more >
How do I fix "the requested module does not provide an export ...
The reason it didn't work is that Vue provides a named export, whereas you are trying to import it as though it had...
Read more >
Migrating - Theme UI
Themed components dict and other exports from @theme-ui/mdx are no longer ... Emotion and @mdx-js/react to peerDependencies to solve context mismatch bugs.
Read more >
Building Better Next.js Static Sites with MDX and Contentlayer
mdx named -exported a meta data. It was picked up by the the default component that took care of the layout and rendered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found