-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 Docs doesn't display after upgrades to React v18.1.0 + Storybook v6.5.6 -> v6.5.7 -> v6.5.8 -> v6.5.9 #18383
Comments
Might be related. |
Thanks @arlukin for the suggestion. Though in my current build, I did not really use the |
@sgrobert Storybook 6.x is still on MDXv1. To use MDXv2, please read the instructions here: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#opt-in-mdx2-support |
Hi @shilman, Thank you for the reply. I have followed the instructions and installed
Please do note that I had also installed I'm also listing the list of error thrown within
Do let me know if you need other information to help find the root of the cause. Thank you. |
Hi @shilman, Another update on the issue. Updated to Seems like the error is now with
Hope that may help with further debugging this issue. Thank you. |
@sgrobert Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro. Thank you! 🙏 |
Hi @shilman, Sadly, my current build is embedded with my company's code repo and due to the work nature, I'm unable to do a reproduction repo to help with the debugging. Would there potentially be other ways where I may assist in helping to pinpoint the potential root cause, so that this issue can be resolved? Thank you! |
@sgrobert if you can create a standalone reproduction that doesn't include any of your company's private code, that would definitely help resolve the issue. See how to create a repro. |
Hi @shilman, I have attempted to use The steps I've selected:
Hope you can redirect me on what to do next to help run the repro. Thank you! |
The repro script requires that you install yarn. |
Hi @shilman, I've just installed
|
Is there a package.json in a directory above where you're trying to create the repro? It looks like there is and it's causing problems. Also you don't need to upgrade to yarn2--the repro script should take care of that. But it shouldn't cause problems AFAIK |
Hi @shilman, Yes. The current folder is where I ran all my work-related builds. Currently, there sit two builds within the same folder:
Pardon me from asking, should I run the Please advise. Thank you! |
You should run sb repro in fresh directory that doesn't contain any package.json and has no package.json in any parent directory |
Hi @shilman, Given so, do I have to manually copy pre-existing files over? As I was wondering how it may help replicate the "problem codes", if it sits on a separate new directory that is outside of the Project Folder. Please do advise on the next steps. Thank you. |
The repro script should provide a basic working storybook instance. Ideally you provide the minimal set of changes to demonstrate the problem. How you do that is up to you! |
Hi @shilman, I have just attempted a fresh repro installation, but was faced with a
So, currently I am still unable to produce a repro repo for you to help vett. |
@sgrobert what project type did you choose? can you share the exact steps you ran? |
Hi @shilman, Here is what I did:
Here is the
|
Hi @shilman, Since we are on the topic, may I ask is it recommended to migrate the build to Hope you can help shed some light prior to my plans to start the mass migration. Thanks! |
Hi @shilman, Just to give a follow-up on the list of issues I've found with the "broken MDX2 on Storybook build":
If you have more updates on how the above might be better resolved, please do assist. Thank you! |
Hi @shilman, Just an update that Could you help to update me if there is a potential patch for this issue or is there a method how this issue can be temporary-patched on my end till the next major upgrade to Thank you. |
Just sharing a possible alternative solution for those not wanting to / not able to use MDX2. I encountered almost all the issues in this thread, and what worked for us was essentially forcing Storybook 6.5.x to use MDX1 by declaring Related dependancies:
Hope this helps someone else! |
Hi @leighnguyen, Thanks for being a lifesaver on this! Downgraded to the following as recommended, and it works!
Though I do understand from @shilman that the migration to Thanks @leighnguyen once again for the help! Closing this thread. |
I know this has been closed but just adding my findings to it. The above change to dependency To get it sorted I needed - installed:
added the following to .storybook/main.js
The mdx pages now work but styles are missing (eg fonts). |
Same happens to me. I enabled MDX2 but lost all styles in MDX pages... |
If I use:
and
I get this error:
If I try to set config option "runtime": "classic" the storybook won't start anymore and hangs on build at 53% Still no solution for Storybook 6.x and React18 |
@TomFreudenberg which builder? FWIW we've fully updated in 7.0-alpha and it seems to be working well |
@shillman Hi Michael, I am using WebPack 5 On production I am not able to switch to alpha release currently - sorry |
@TomFreudenberg Looks like this might be addressed here storybookjs/mdx2-csf#10. if i cut a release with that feature, would you be able to take it for a spin? |
For sure I do Please let me know what to add / change for options in addition if necessary. |
@TomFreudenberg On closer inspection that PR might be a red herring. What does it look like when you go to the "Sources" tab in chrome and look at the compiled MDX source? I'm looking at an MDX2 Storybook now and it looks like this Perhaps that is a clue for why your babel config is choking? |
@shilman I do not come to this point to check the source like that: In the moment I enable MDX2 like in above comment #18383 (comment) I can't start storybook anymore due to the pragmaError If I don't enable MDX2, I got the error: Introduction.stories.mdx:227 Uncaught TypeError: (0 , mdx_js_react__WEBPACK_IMPORTED_MODULE_12_.mdx) is not a function |
@TomFreudenberg Ouch. Are you sure that you can't get MDX1 working with React 18? If this was a general problem I think I would've heard about it. |
@shilman, to be honest, I have not tried to enable MDX1 in our current environment. All I had read about that made myself a feeling of "too much (peer) dependencies" and so I left out MDX for our stories. But for using DOCS addon it would be nice to have MDX working - that's why we brought it up again. |
@TomFreudenberg If you're having problems I'd recommend skipping MDX for now. We are making huge improvements to MDX handling in 7.0 and fully switching over to MDX2 as well, so if you're looking to pick it up, that might be a better time to do it. |
Yes - agree - let's do it in this way! Thanks for discussion and feedback Michael @shilman |
@TomFreudenberg you're very welcome! sorry this was causing problems. hoping we can get to a "just works" state in 7.0 and keep major releases coming more frequently so we can avoid more weird |
@shilman I know its in alpha right now but do we have a tentative release date for V7? |
@marcusvalverde rough ETA is beta in mid-december, RC/final in Q1 next year |
Same error from composed storybook( |
Cool cool , and by any chance are there plans to resolve the MDX stuff or the beta @shilman ? |
@marcusvalverde AFAIK MDX2 is working great in the beta. Migration guide: https://storybook.js.org/migration-guides/7.0 |
Describe the bug
I was previously running on React v18 + Storybook v6.4.22, which was working well.
After I initiated the update to React v18.1.0 + Storybook v6.5.6, at first there was an old error of unable to detect
@mdx-js/react
in thenodes_modules
folder, by which I had subsequently installed@mdx-js/react v^2.1.1
+@mdx-js/preact v^2.1.1
which resolved the loading of Storybook in the browser issue.However, then I did realize that the usual
Docs
in my.mdx
files do not load anymore.To Reproduce
[This is a work-related build, thus I will not be able to showcase all the info]
These are the main related dependencies I'm using:
...
"next": "^12.1.6",
"react": "18.1.0",
"react-dom": "18.1.0",
...
"@mdx-js/preact": "^2.1.1",
"@mdx-js/react": "^2.1.1",
"@storybook/addon-actions": "^6.5.6",
"@storybook/addon-docs": "^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-webpack5": "^6.5.6",
"@storybook/manager-webpack5": "^6.5.6",
"@storybook/react": "^6.5.6",
"@storybook/testing-library": "^0.0.11",
...
"eslint-plugin-storybook": "^0.5.12",
...
System
Environment Info:
System:
OS: macOS 12.4
CPU: (8) arm64 Apple M1
Binaries:
Node: 18.2.0 - /opt/homebrew/bin/node
npm: 8.9.0 - /opt/homebrew/bin/npm
Browsers:
Chrome: 102.0.5005.61
Firefox: 100.0.2
Safari: 15.5
npmPackages:
@storybook/addon-actions: ^6.5.6 => 6.5.6
@storybook/addon-docs: ^6.5.6 => 6.5.6
@storybook/addon-essentials: ^6.5.6 => 6.5.6
@storybook/addon-interactions: ^6.5.6 => 6.5.6
@storybook/addon-links: ^6.5.6 => 6.5.6
@storybook/addon-postcss: ^2.0.0 => 2.0.0
@storybook/builder-webpack5: ^6.5.6 => 6.5.6
@storybook/manager-webpack5: ^6.5.6 => 6.5.6
@storybook/react: ^6.5.6 => 6.5.6
@storybook/testing-library: ^0.0.11 => 0.0.11
Additional context
npm run storybook
, it loads to the browser andDocs
do not load. While accessingCanvas
, it throws the following errror:npm run build-storybook
, it throws a consistent bulk error of:WARN export 'mdx' (imported as 'mdx') was not found in '@mdx-js/react' (possible exports: MDXContext, MDXProvider, useMDXComponents, withMDXComponents)
I'm not sure if the above is related in any way.
Hope to seek guidance and assistance to help restore the
Docs
view for my.mdx
files.Thank you!
The text was updated successfully, but these errors were encountered: