Skip to content

feat: scope css to js module to allow treeshaking it (requires vite 6.2) #1092

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

Merged
merged 7 commits into from
Apr 22, 2025

Conversation

dominikg
Copy link
Member

@dominikg dominikg commented Mar 2, 2025

see vitejs/vite#19418

This allows vite to treeshake unused svelte component css if the component was referenced in a barrel file.

@dominikg
Copy link
Member Author

the regex approach is a bit less clunky i think. least clunk inside vps would be an option that allows users to define the tests themselves on filename+content, similar to dynamicCompileOptions.

@dominikg
Copy link
Member Author

reninder to self: switch to css.hasGlobal sveltejs/svelte#15450 (comment)

@dominikg dominikg merged commit fc19a92 into main Apr 22, 2025
6 checks passed
@dominikg dominikg deleted the feat/css-shake branch April 22, 2025 08:45
@github-actions github-actions bot mentioned this pull request Apr 22, 2025
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

Successfully merging this pull request may close these issues.

2 participants