Skip to content

perf(turbopack): split dynamic HMR chunk lists#169

Open
fireairforce wants to merge 4 commits into
utoofrom
zoomdong/split-hmr-chunk-lists
Open

perf(turbopack): split dynamic HMR chunk lists#169
fireairforce wants to merge 4 commits into
utoofrom
zoomdong/split-hmr-chunk-lists

Conversation

@fireairforce

Copy link
Copy Markdown
Member

Summary

  • add an opt-in browser chunking mode that registers one HMR chunk list per dynamic chunk group
  • keep the entry HMR list limited to directly generated and caller-provided chunks
  • preserve the existing recursive entry-list behavior unless the new builder option is enabled

Why

Large eager applications can have thousands of lazy chunks. Recursively placing all of them in the entry HMR list makes every subscription and update traverse the whole application graph. Utoopack enables this option only in development.

Validation

  • cargo check -p pack-core passed in the Utoopack parent workspace, including turbopack-browser
  • targeted dynamic_chunk_lists Rust snapshot and runtime assertion passed
  • targeted rustfmt and git diff --check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the enable_dynamic_hmr_chunk_lists option to BrowserChunkingContext, allowing separate HMR chunk lists to be generated for each dynamic chunk group instead of recursively adding all reachable dynamic chunks to the entry chunk list. Feedback on the changes highlights a potential issue where a redundant dynamic HMR chunk list register chunk is generated for the entry chunk group, which already has its own registration. It is recommended to skip this generation when the current chunk group is the root entry chunk group.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread turbopack/crates/turbopack-browser/src/chunking_context.rs Outdated
@fireairforce
fireairforce force-pushed the zoomdong/split-hmr-chunk-lists branch from e9fc719 to 8c80c8b Compare July 21, 2026 12:04
@fireairforce

Copy link
Copy Markdown
Member Author

安全加固已补齐并推送:动态 chunk list 现在先建立带 expectedVersion/validation token 的 HMR baseline,成员 HTTP 加载后再二次校验;更新按 batch 去重,JS/CSS 使用内容版本 URL 并做精确 owner/清理;missing、重连、旧帧和并发 generation 均有终止路径。standalone WebSocket 也补了 clean close 重连。验证:相关 cargo check/clippy 通过;Utoo 侧真实 Chromium HMR E2E 8 个场景 repeat 3,共 24/24 通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant