Skip to content

Svelte components doesn't get styles when rendered conditionally in production #14252

@forberg

Description

@forberg

Astro Info

Astro                    v5.13.2
Node                     v23.11.1
System                   Linux (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/svelte
                         @astrojs/react

Describe the Bug

When rendering svelte component conditionally, styles aren't applied when building for production. When using development server, it works just fine.

Rendering React components conditionally works fine in production (see react page in example)

What's the expected result?

Include styles from svelte component even if rendered conditionally in production, as it does in development.

Link to Minimal Reproducible Example

https://stackblitz.com/github/M4R7iNP/astrobugtest?file=README.md

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly impacts performance (priority)feat: stylingRelated to styles (scope)pkg: svelteRelated to Svelte (scope)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions