Skip to content

Styles aren't always included in dev mode #16181

@jurajkapsz

Description

@jurajkapsz

Astro Info

Astro                    v6.1.2
Vite                     v7.3.1
Node                     v24.6.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/node (v10.0.4)
Integrations             @astrojs/mdx (v5.0.3)
                         build/info
                         build/images
                         build/cleanup
                         @astrojs/sitemap (v3.7.2)
                         gab-astro-compress (v0.1.2)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

After upgrading an Astro v5 project to Astro v6, it happens that the .astro component styles aren't included in the dev mode output.

Use case:

  • I have .astro components, that contains some markup, script and style tag:
<h1>My Component</h1>

<script> // component script </script>

<style type="scss" is:global> /* component styles */</style>
  • The components are included in multiple pages (as part of mdx content), for example:
---
frontmatter...
---

import Photo from "@components/content/photo.astro";

Some paragraph...

<Photo ... />

Some paragraph...
  • When browsing the website in dev mode, the style of some components is most of the time missing, but not always; ie on certain pages the component has its styles included, on others it does not and the presentation is broken.
  • After running build, the styles are again present as they should, even in places, where they were missing in dev mode.

I was not able to reproduce this on a brand new Astro v6 install yet.

This issue appeared alongside #16179 issue (after upgrade to Astro v6).

What's the expected result?

All styles should be present in dev mode view the same way as later in the built version (or like in Astro v5).

Link to Minimal Reproducible Example

Participation

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

Metadata

Metadata

Assignees

Labels

needs responseIssue needs response from OPneeds triageIssue needs to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions