[DO NOT MERGE] Enable server HMR by default for testing#90389
[DO NOT MERGE] Enable server HMR by default for testing#90389wbinnssmith wants to merge 2 commits intoserver-hmr-sourcemapsfrom
Conversation
Failing test suitesCommit: de01a81 | About building and testing Next.js
Expand output● app dir - navigation › hash › should scroll to the specified hash
Expand output● deterministic build - changing deployment id › build output API - builder › should produce identical build outputs even when changing deployment id |
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **400 kB** → **400 kB** ✅ -13 B80 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
ff2f17a to
4c3a0f3
Compare
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
4c3a0f3 to
52cd1eb
Compare
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
2d9a5e5 to
d83b366
Compare
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
7b18f67 to
0421f64
Compare
This is cherry-picked from #90389, which also serves as a test case for server hmr being enabled by default. This fixes a number of issues with server hmr, most notably that pages router updates weren’t reflected: 1. **Pages Router pages weren't clearing the chunk cache** — the old condition (which just checked the cli flag) meant the chunk cache was only cleared when server HMR was entirely absent. Once server HMR was enabled, Pages Router pages (which don't use the Turbopack module registry) got stale. 2. **`deleteCache` was skipped for files with server HMR subscriptions** — this left stale entries in `evalManifest`'s `sharedCache`, causing "Could not find module in React Client Manifest" errors when new `'use client'` components were added. 3. **`clearModuleContext` was skipped for middleware and edge routes** — server HMR subscriptions include edge runtime chunks, but `__turbopack_server_hmr_apply__` can't reach those sandboxes. They need `clearModuleContext` called explicitly. 4. **Chunk cache wasn't cleared for `.env`/config changes** — when `force: true` (no code change), module-level env captures stayed stale. Now `__next__clear_chunk_cache__()` is called unconditionally when `force` is set.
7b9b517 to
57713d3
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
bff7767 to
1306418
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
23737d8 to
556f1b2
Compare
556f1b2 to
5e1b2ff
Compare
This adds and calls \`maybeInlineSourcemap()\` to the Turbopack Node.js HMR runtime that appends \`//# sourceURL\` and \`//# sourceMappingURL\` (base64-encoded) to each `eval`ed module entry Test Plan: CI for #90389
5e1b2ff to
1190e3a
Compare
34647db to
8cd12ca
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
1190e3a to
f781f5c
Compare
8cd12ca to
3c19fa8
Compare
f781f5c to
c137904
Compare
Do not merge this. This PR currently exists only so that we can run the e2e test suite with server hmr applied.
c137904 to
de01a81
Compare
3c19fa8 to
65345c7
Compare

Do not merge this. This PR currently exists only so that we can run the e2e test suite with server hmr applied.