-
Notifications
You must be signed in to change notification settings - Fork 106
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
@mdx-js_react.js does not provide an export named 'mdx' [Bug] #398
Comments
This looks similar to #391. Are you using react 18, either in that package of your monorepo or another one in the monorepo? |
Hi @IanVS - Thanks for addressing this! Other than as a dependency of Storybook(?) I'm not using React anywhere. Everything I build is in Vue3. |
Interesting. I think you can work around this for now with |
Well, that got rid of the error message! But now when I load When I check the console, I see these errors:
|
That part is normal, it's because react 17 is still used to generate the docs pages. Can you provide a reproduction that we can look into? Otherwise, it's difficult to help troubleshoot. |
@IanVS repository
|
It looks like you've got a mix of react 18 and react 17 in the project, due to different sub-packages wanting different versions. I think that perhaps, if you delete your Hopefully this is a temporary condition until we can get mdx straightened out. |
Hi @IanVS I just uploaded a reproducible example and added you as a collaborator. Please let me know if you do not receive the invite from Github. I hope this helps! Thanks! |
Okay, I just tested the suggested solution and can confirm that this does not solve the problem. Steps to reproduce:
|
@adamSneller sorry, that suggestion was for @l4dybird. I took a look at your reproduction (thanks for providing it), and I got it working by explicitly installing react@17. This shouldn't have to be necessary, and hopefully you'll be able to remove it once we get MDX all sorted out. I pushed up two commits to the main branch of your repo. |
Wow, that did it! Thanks @IanVS - that's fantastic! |
Fixes #234 Fixes #391 Fixes #398 To enable experimental MDX2 in a project, follow this guide: https://gist.github.com/shilman/6ff2d7e18db8846e8fc552fb432ae4f6 * Support MDXv2 * Fix formatting * Remove explicit mdx-js/preact from example * Remove workarounds from readme * Add @storybook/mdx2-csf to examples using it Co-authored-by: Ian VanSchooten <ian.vanschooten@gmail.com>
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... |
@IanVS my hero! I'm in the middle of upgrading a React/Storybook/Vite project to React 18, ran into this exact issue where mdx stories wouldn't load due to the error and your suggestion to install 1.x of mdx-js/react worked! Also this quote
So glad I found this GH issue, because I was confused why I was still seeing that message in the console and thought the upgrade didn't work 😇 |
I'm also on React 18 w/vite, and I was able to get up and running with |
@techpeace the other thing you can try is to use mdx2, which actually is made for react 18. https://gist.github.com/shilman/6ff2d7e18db8846e8fc552fb432ae4f6. I wonder if that would also solve the issue for you. |
Thanks, @IanVS! Running through those instructions,
This may have something to do with my using pnpm (though that subpath is indeed not defined). Not a huge deal, since I got it running with the 1.x branch, for the moment. |
You shouldn't need to use |
@IanVS if
The only way I get get it to compile is to include |
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(R) Core(TM) 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:
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
The text was updated successfully, but these errors were encountered: