Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #24046.
An SSR import can pause in top-level await while a file change triggers a full reload. Its later imports then use the newly cleared module cache, so one completed import can contain two instances of the same registry module.
Keep module indexes and pending fetches associated with their import graph across a full reload. Resolve late URL aliases through that graph, retain the supplied public cache object, and preserve the existing three-argument
directRequestoverride. Retired HMR contexts share persistenthot.dataand register callbacks while their graph is current.The merge with main
4db98449incorporates bundled SSR from #21626. It preserves bundled runtime reset, HMR queues, transport and lazy loading, and associates custom hot contexts and retained source maps with their owning graph. The contribution against that main covers five files.Reproduction and validation
The regression fixture uses public
createServer,configFile: false,envFile: false, real watched file edits, and independent gates for old and fresh evaluations. It covers both completion orders, static and dynamic imports, pending fetches, aliases, cycles/TLA, live bindings, persistent data and subsequent HMR. The 22 cases include three integration regressions for custom hot contexts and retained source maps. Exact reviewed regression sourceWith repository dependencies installed, run the focused regression and package checks.
pnpm --config.verify-deps-before-run=false exec vitest run packages/vite/src/node/ssr/runtime/__tests__/server-full-reload.spec.ts pnpm --config.verify-deps-before-run=false --filter vite run build pnpm --config.verify-deps-before-run=false --filter vite run typecheckIndependent execution on macOS arm64, Node 24.22.2, for
ef7817cc8a751365fb438546c3779ac6b2004c17passed 230 related runtime/SSR/HMR/worker/source-map tests and 100 filesystem-safety tests. Main passed 208 related tests and the same 100 safety tests. Both retain five upstream skips, including the two bundled-mode exclusions. Build, declarations, typecheck, lint and formatting passed. The module-runner build is 70,935 bytes against main's existing 71,000-byte limit, with 65 bytes remaining. A clean, uncommitted integration with newer mainf8988882passed the same runtime and safety suites, formal build and typecheck, plus Node SSR rendering controls for CSS, Sass and Less package imports.Unchanged public
afa16694and the merge head both passed normal import controls and real watcher reloads with old-first and fresh-first completion. The observed identity trace for each completion order was as follows.The compiled browser HMR client passed an isolated VM control with simulated WebSocket and dynamic loading. Real-browser/DOM/network and ecosystem suites remain untested. Native Windows Node26 remains untested locally, and the earlier Windows CI timeout cause remains unresolved. Retired-graph collection was observed in one bounded GC check. Large-graph performance remains unmeasured.
Review
AI coding agents assisted implementation and independent review. The review covered the complete original-base range of 114 files and 17 commits, the public-head-to-merge range, both merge parents, and actual current-main integration. It checked the 109 upstream-identical file entries and examined the five contribution files, graph ownership, callback registration, shared persistent data, custom caches, source maps and API compatibility.
Per-graph retention lets pending evaluations finish independently. Already loaded exports retain graph-local identity. A dependency first loaded later can read current disk contents.