[Feature Request]: compute HMR boundaries on the client instead of the server
What problem does this feature solve?
In Full Bundle Mode (FBM), Rolldown computes HMR boundaries on the server (Rust): it waits for every module to register, detects the file change, computes the affected modules, generates the patch, and ships it — tracking each client's executed_modules server-side. This server-centric model has costs that now block FBM's hardening:
- Per-client state lives on the server. Boundary computation needs each tab's executed-module set, so every browser client has to report its
executed_modulesback to the server. With multiple tabs open, the server owns state that conceptually belongs to each client. - Patches re-send code the client already has. There is no module-factory map on the client to diff against, so an update can't cheaply carry only the factories that changed and haven't been sent yet.
- Two divergent HMR models. Bundleless HMR already computes boundaries in JS; FBM computes them in Rust. Maintaining two mental models is a long-term tax.
As a side effect it also fixes a lazy-compilation duplicate-execution bug — a module shared by two lazy entries lands in both lazy chunks and runs twice; non-idempotent init then throws (e.g. Uncaught TypeError: Cannot redefine property). That will be filed as its own bug; this request is about the mechanism that makes the fix natural.
Prior art. This is Webpack's model: the runtime holds a module-factory map keyed by module id, with module.hot / module.parent / module.children in the runtime; an HMR chunk updates the factory map and the runtime runs the boundary calculation and re-executes (import.meta.webpackHot.accept → module.hot.accept). Vite's own bundleless HMR likewise computes boundaries in JS.
Tracked as the "HMR boundary calculation refactor" line under FBM Phase 2, #10019. Related: #10024 (skip no-op HMR updates); the hotUpdate/handleHotUpdate investigation is a separate line in the same tracker.
What does the proposed API look like?
Not a public API change. This is an internal refactor of the HMR mechanism between Rolldown and the runtime, gated behind an experimental opt-in (working name experimental.newHMRFormat) for rollout. The behavioral change is described above — boundary computation moves from the server to the client.
Source: rolldown/rolldown