Skip to content

add "hasUnscopedGlobalCss" metadata to compiler ouput #15449

Closed
@dominikg

Description

@dominikg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions