Skip to content

🐞 Bug: Svelte strips styles of components that export only snippets #16404

@katriellucas

Description

@katriellucas

Describe the bug

IF snippets have styles, they are ignored and removed/stripped from the build (but on local/dev is fine).

Reproduction

Make a .svelte file that export snippets only, then add styles on these exported snippets, import it in any file/page, build with bun run build (or npm), then bun run preview, no styles will be generated.

https://svelte.dev/playground/untitled?version=5.36.4#H4sIAAAAAAAACnWQzU7EIBDHX4WMFzep7R3rxn0G40k8sGVqiHQgMNXdEN7d0K3R-nFj_h_wYzKQnhAkPBJbdmiggdE6TCCfMvA5VK8K0HwmDyG06Q0dV-2oE_6lD54YiRNI6NMQbeC9IsV2Cj6yyOKBbBBFjNFPQkHb1XltK1DUd18lyvcRyWBcStcKbkREo2BXoAHGE4PkOGNp_uH9dvUWeGv8JhaTN7PDBRxPG_CfhFeJbAjIF8TBOx93pfb6IAanU7pTsEDv82KWvgt7RblbezVLfeLz-lwb0YhcT4qPenh9iX4mI-vHb6t6AVji2yU8N8DaundLBuSoXcLyATvzYuXjAQAA

App for the IDE.

svelte-app.zip

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics
    Memory: 3.87 GB / 15.35 GB
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.2.0 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.18 - ~\AppData\Roaming\npm\bun.CMD
  Browsers: {}

Severity

annoyance

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