nextjs - ✅(Solved) Fix 16.2 broke Safari HMR for SCSS files [1 pull requests, 4 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91818Fetched 2026-04-08 01:16:09
View on GitHub
Comments
4
Participants
4
Timeline
15
Reactions
3
Timeline (top)
referenced ×5commented ×4closed ×1cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #92123: [turbopack] Fix CSS HMR on Safari

Description (problem / solution / changelog)

Fixes #91818

Regression source: Commit b7e4c6a011 ("Turbopack: transpile CHUNK_SUFFIX") introduced getChunkSuffixFromScriptSrc() which reads query strings from <script> tags. On Safari, this picks up the ?ts= param injected by the server-side cache-busting workaround in render.tsx (for WebKit #187726), baking it into ASSET_SUFFIX. This causes HMR CSS URLs to match the preloaded URL exactly, re-triggering the Safari preload cache bug and preventing style updates.

Changes:

  • dev-backend-dom.ts: Match existing <link> elements by base path (strip query string) so selectors work across HMR updates with different ?ts= values. Add Safari to the Firefox cache-busting branch so new stylesheet links always get a fresh ?ts=.
  • hmr-client.ts: Fix mergeChunkUpdates so a total update always supersedes any prior update type.

Changed files

  • .github/workflows/build_and_test.yml (modified, +10/-5)
  • packages/next/src/build/swc/generated-native.d.ts (modified, +10/-10)
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/dev/hmr-client/hmr-client.ts (modified, +5/-0)
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/dom/dev-backend-dom.ts (modified, +31/-12)
  • turbopack/crates/turbopack-ecmascript-runtime/js/src/browser/runtime/dom/runtime-backend-dom.ts (modified, +4/-7)
  • turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map (modified, +3/-3)
  • turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/output/1i9t_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js (modified, +32/-15)
  • turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/0_9x_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_17smy-b.js.map (modified, +2/-2)
  • turbopack/crates/turbopack-tests/tests/snapshot/runtime/default_dev_runtime/output/0rv8_turbopack-tests_tests_snapshot_runtime_default_dev_runtime_input_index_17smy-b.js (modified, +30/-13)
  • turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/0_9x_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_04jskxh.js.map (modified, +1/-1)
  • turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/0rv8_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_04jskxh.js (modified, +6/-3)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/basic/output/1do3_crates_turbopack-tests_tests_snapshot_workers_basic_input_index_09-gc7x.js.map (modified, +2/-2)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/basic/output/1do3_crates_turbopack-tests_tests_snapshot_workers_basic_input_worker_0yr5fg0.js.map (modified, +2/-2)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/basic/output/1i9t_crates_turbopack-tests_tests_snapshot_workers_basic_input_index_09-gc7x.js (modified, +30/-13)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/basic/output/1i9t_crates_turbopack-tests_tests_snapshot_workers_basic_input_worker_0yr5fg0.js (modified, +30/-13)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/shared/output/1do3_crates_turbopack-tests_tests_snapshot_workers_shared_input_index_0arnewp.js.map (modified, +2/-2)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/shared/output/1do3_crates_turbopack-tests_tests_snapshot_workers_shared_input_worker_1xw116u.js.map (modified, +2/-2)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/shared/output/1i9t_crates_turbopack-tests_tests_snapshot_workers_shared_input_index_0arnewp.js (modified, +30/-13)
  • turbopack/crates/turbopack-tests/tests/snapshot/workers/shared/output/1i9t_crates_turbopack-tests_tests_snapshot_workers_shared_input_worker_1xw116u.js (modified, +30/-13)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:55:08 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 22.21.1
  npm: 10.9.4
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.11 // There is a newer version (16.2.1) available, upgrade recommended!
  eslint-config-next: 14.2.33
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/berkaytheunicorn/nextjs-hmr-scss

To Reproduce

Just open Safari 26.3.1 and update a SCSS file (not nested)

Current vs. Expected behavior

HMR triggers won't update css in the Safari.

Downgrading to 16.0.11 fix the issue. (16.1.x won't)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:55:08 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 22.21.1
  npm: 10.9.4
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.0.11 // There is a newer version (16.2.1) available, upgrade recommended!
  eslint-config-next: 14.2.33
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3

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

CSS

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

next dev (local)

Additional context

No response

extent analysis

Fix Plan

The fix involves downgrading next to version 16.0.11 as the issue is not present in this version.

  • Run the following command to downgrade next:
npm install [email protected]
  • Alternatively, if you are using yarn, run:
  • If you are using pnpm, run:
pnpm install [email protected]

Verification

To verify that the fix worked, follow these steps:

  • Open Safari 26.3.1
  • Update a SCSS file
  • Check if HMR triggers update the CSS

Extra Tips

Note that downgrading next might introduce other compatibility issues. It's recommended to keep an eye on the next repository for updates that might fix this issue in newer versions.

Also, consider opening an issue in the next repository to report this problem, so it can be addressed in future releases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING