Repository navigation
feat(bundled-dev): support worker file update accepted by HMR - #23068
Merged
sapphi-red merged 3 commits intoJul 28, 2026
Merged
sapphi-red merged 3 commits into
sapphi-red merged 3 commits into
Conversation
sapphi-red
reviewed
Jul 27, 2026
sapphi-red
approved these changes
Jul 28, 2026
sapphi-red
enabled auto-merge (squash)
July 28, 2026 05:25
sapphi-red
deleted the
07-27-fix_worker_serve_workers_updated_through_an_hmr_patch_in_bundled_dev
branch
July 28, 2026 05:32
This was referenced Oct 9, 2026
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.
Problem
In bundled dev (
experimental.bundledDev), editing a worker source leaves the page running the old worker. The request for the new worker file returns200withtext/html(the SPA fallback), so the browser cannot parse it as a module worker and only reports anerrorevent with an undefined message. The network panel looks fine, so this is easy to miss.Affects both
new Worker(new URL('./w.js', import.meta.url))andimport Worker from './w.js?worker', and a worker spawned from inside another worker.It only reproduces when the importing module is an HMR boundary. Without one the edit escalates to a full reload, which rebuilds and emits the worker. React Fast Refresh makes self-accepting importers the norm, so real apps sit on the failing path.
Cause
vite:workersplits the work across two phases:loadresolves the final worker URL and writes it into the modulegenerateBundlehands the worker bytes to the bundlerAn HMR patch is generated without a generate phase, so only the first half runs. Worker filenames carry a content hash, so an edited worker gets a new filename that was never emitted.
vite:assetavoids this by callingemitFileduringload, before deriving the URL from it.Related Issues
Part of the Full Bundle Mode plugin coverage work (rolldown/rolldown#10469).