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

add "hasUnscopedGlobalCss" metadata to compiler ouput #15449

Open
dominikg opened this issue Mar 5, 2025 · 0 comments · May be fixed by #15450
Open

add "hasUnscopedGlobalCss" metadata to compiler ouput #15449

dominikg opened this issue Mar 5, 2025 · 0 comments · May be fixed by #15450

Comments

@dominikg
Copy link
Member

dominikg commented Mar 5, 2025

Describe the problem

vite-plugin-svelte can use a feature in vite 6.2 to scope the css module containing styles to the js module of the component, which helps to treeshake unused css from components that are referenced in barrel files but never used in an app.

see sveltejs/vite-plugin-svelte#1092

This can not be done in a non-breaking way if a style block contains unscoped global styles, so vite-plugin-svelte needs this information and currently has to add zimmerframe and walk the css ast itself to determine if there is a selector that starts with :global.

Describe the proposed solution

when svelte compile creates the css output, it can determine this and add it to a new meta prop on Code, making it available to other tools as well and avoid the extra dependency/code/perf hit in vite-plugin-svelte.

Importance

would make my life easier

@paoloricciuti paoloricciuti linked a pull request Mar 5, 2025 that will close this issue
6 tasks
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 a pull request may close this issue.

1 participant