-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Bug]: @storybook/react-vite configuration for react-docgen doesn't support components that import postcss modules. #25662
Comments
This error is pretty strange. I would assume that |
Your Stackblitz reproduction fails before it gets to this point, so I cannot verify the behavior. However, looking at the code, you are using 7.6 and have not specified an alternative https://storybook.js.org/docs/api/main-config-typescript#reactdocgen |
Thanks for getting back to me, appreciate it.
I hadn't saved the stackblitz, I've updated it and it is now showing the error. View the Button story to trigger it.
I tried it with
Thanks, will do |
Hi there! Thank you for opening this issue, but it has been marked as |
Hey, is there any more information I can provide here? |
Thanks, I'm using the export unfortunately, to compile a separate CriticalCss component that imports the built stylesheet (with classes) |
Just adding I get this same error without using vite (just
|
I think this relates to: |
Describe the bug
Have a component like so
And where the css file contains an
@import
The babel config passed to
react-docgen
doesn't take into account the .babelrc file and attempts to parse the .css file as JavaScript.This causes an error like so
Is there anyway to configure react-docgen to ignore .css files in this case?
At present have fallen back to disabling it and manually putting
description
properties on argTypes instead of auto-generating them from propType docblocks.Note we use rollup-plugin-postcss to allow emitting a single inline critical css component with the exported stylesheets.
We have a vite plugin (See the reproduction code) that does the equivalent.
To Reproduce
https://stackblitz.com/edit/github-cwovgn-yvzreq?file=src%2Fstories%2FButton.jsx
System
Additional context
We're exporting the stylesheet so we can get reliable class names from CSS modules and combine them into a single critical CSS file that we inline.
The text was updated successfully, but these errors were encountered: