Skip to content
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

CSS files imported from inside other CSS files aren't included in generated JSON file #12

Open
s-robertson opened this issue Oct 19, 2023 · 0 comments

Comments

@s-robertson
Copy link

s-robertson commented Oct 19, 2023

CSS files that are imported via a CSS @import aren't included in preview-stats.json.

For example, if I have a component that does import './index.css' and index.css has code such as the following:

@import './my-component.css'

index.css will show up inside preview-stats.json when you run a Storybook build, but my-component.css won't.

I was doing some debugging of this issue and it seems that in the moduleParsed Rollup hook, CSS imports aren't listed in the dynamicallyImportedIds or importedIds arrays. I'm assuming this is because Vite itself is using another Rollup plugin (css-import?) to handle @import statements, so the dependency info never makes its way to vite-plugin-turbosnap.

I'm wondering if this is something that vite-plugin-turbosnap might be able to support in some way? I'm not too familiar with Rollup plugins so I'm not sure if there's maybe another hook where the CSS import info is available?

@s-robertson s-robertson changed the title CSS imports aren't included in generated JSON file CSS files imported from inside other CSS files aren't included in generated JSON file Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant