Skip to content

SASS styles are cleared up after HMR in lazy components #78448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sdoomz opened this issue Apr 23, 2025 · 0 comments
Open

SASS styles are cleared up after HMR in lazy components #78448

sdoomz opened this issue Apr 23, 2025 · 0 comments
Labels
Lazy Loading Related to Next.js Lazy Loading (e.g., next/dynamic or React.lazy).

Comments

@sdoomz
Copy link

sdoomz commented Apr 23, 2025

Link to the code that reproduces this issue

https://github.com/sdoomz/nextjs-sass-hmr-not-applied-bug

To Reproduce

  1. git clone https://github.com/sdoomz/nextjs-sass-hmr-not-applied-bug
  2. npm install
  3. npm run dev
  4. open http://localhost:3000 and follow instructions

Current vs. Expected behavior

Current behavior:
Styles are cleared up after HMR in lazy component

Expected behavior:
Styles should be preserved after HMR in lazy component

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:22:00 PST 2025; root:xnu-11215.81.4~3/RELEASE_X86_64
  Available memory (MB): 32768
  Available CPU cores: 8
Binaries:
  Node: 23.11.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.3.1 // Latest available version is detected (15.3.1).
  eslint-config-next: 15.3.1
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Lazy Loading

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

The issue started to reproduce since next@15.0.0, only legacy npm run dev is affected, no issue for npm run dev --turbo.

Screen.Recording.2025-04-23.at.12.42.35.mov
@github-actions github-actions bot added the Lazy Loading Related to Next.js Lazy Loading (e.g., next/dynamic or React.lazy). label Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lazy Loading Related to Next.js Lazy Loading (e.g., next/dynamic or React.lazy).
Projects
None yet
Development

No branches or pull requests

1 participant