Skip to content

SCSS file changes trigger full page reload instead of HMR #14869

@aralroca

Description

@aralroca

Astro Info

Astro                    v5.14.3
Vite                     v6.3.6
Node                     v22.14.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node (v9.4.4)

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

Chrome

Describe the Bug

When modifying .scss files during development, Astro triggers a full page reload instead of hot module replacement (HMR). This disrupts the development workflow as it loses current state and scroll position.

If I write:

 if (import.meta.hot) {
     import.meta.hot.on('vite:beforeFullReload', (payload) => {
       console.log(payload);
     })
}

After save a .scss file, this log appears:

{type: 'full-reload'}

What's the expected result?

Changes to .scss files should trigger CSS-only hot updates without a full page reload.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-f9txtpa5?file=src%2Fcomponents%2FExample.module.scss

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)feat: hmrRelated to HMR (scope)feat: stylingRelated to styles (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions