Repository navigation
fix(hmr): invalidate cached chunks when version tags change - #16548
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
📦 Binary Size-limit
🙈 Size remains the same at 68.65MB |
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
Merging this PR will not alter performance
Comparing Footnotes
|
d13b085 to
19a05fc
Compare
Motivation
Adding an export to a module shared by the entry and an async chunk can change the async chunk's HMR version without changing its generated factories. Its content hash stays unchanged, so the render cache reuses a chunk with the old version tag while the runtime expects the new version. Fresh page loads then fail with "Chunk is from another build, and no update leads to it".
Fixes #16542.
Changes
Include the emitted HMR version tag in the JavaScript content hash for chunks carrying HMR version metadata. A tag change now invalidates the rendered asset and updates
[contenthash]filenames. Builds without HMR, including production builds, do not gain version metadata.Add 36 regression scenarios covering JSONP, CommonJS and ESM chunks, both runtime modes, stable and content-hashed filenames, and HMR/development/production builds. Check fresh page loads, HMR application, absence of version metadata without HMR, and stable assets after an unrelated edit.
Validation:
pnpm run build:binding:devandpnpm run build:jspass.APP CHUNK.