Repository navigation
fix(hmr): validate chunk versions before installation - #16360
Conversation
Codex Review SummaryThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying rspack with
|
| Latest commit: |
d9cee64
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://630122f9.rspack-v2.pages.dev |
| Branch Preview URL: | https://fy-hmr-chunk-version-check.rspack-v2.pages.dev |
📦 Binary Size-limit
❌ Size increased by 48.13KB from 67.95MB to 67.99MB (⬆️0.07%) |
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
|
29e4ba2 to
c699287
Compare
c699287 to
bb1bba9
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Co-authored-by: JSerFeng <57202839+JSerFeng@users.noreply.github.com>
|
|
This reverts commit ad2c0a8.
Motivation
A dynamic import can receive a newer chunk before HMR catches up, or an old response can arrive after an update. Checking only after installation lets incompatible factories or chunk runtime code affect the running application.
Validate per-chunk JavaScript versions before installation, following webpack's versioning strategy. Unrelated compilations should not rewrite unchanged chunk assets.
Changes
RuntimeModule.generate_update. No manifest fields or loaded-version table are added.require.ein the HMR runtime; remove the separatehmrEruntime global. Rspack runtime mode uses the same wrapper through its module context. Concurrent callers share one retry chain per in-flight chunk. Compatible loads complete normally; a version mismatch waits for HMR progress and retries. Only the current downloads block prepare, including any hot-update downloads issued by the ensure handlers.output.chunkLoadTimeout. A status handler awaiting that import can otherwise form a circular dependency. Timeout rejects the import withChunkLoadError; ready-handler rejections also propagate tohot.check(). Waiting listeners and timers are removed. A handler that catches the error can let HMR finish and import again afterwards.Three fixtures cover version-map patches, synchronous loaders, and async loading schedules in both runtime modes. The compact status-handler cases cover compatible responses, future responses with automatic/manual apply, catching the timeout, and an unrelated asynchronous handler. Generated snapshots and the WebRunner asset-cache adjustment remain included.
Validation: