Skip to content

fix(bundled-dev): emit assets referenced by inline workers during load - #23103

Merged
sapphi-red merged 6 commits into
vitejs:mainfrom
btea:fix/bundled-dev-inline-worker-assets
Nov 10, 2026
Merged

sapphi-red merged 6 commits into
vitejs:mainfrom
btea:fix/bundled-dev-inline-worker-assets

Conversation

@btea

@btea btea commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The inline branch of vite:worker (?worker&inline, ?sharedworker&inline) embeds the worker entry as a blob URL, but assets the worker references are still emitted as separate files. Those files normally reach the output through generateBundle, which an HMR patch skips. When the worker is re-bundled for a patch, the referenced asset gets a new content-hash filename that was never emitted, so requests for it fall through to the SPA fallback and return text/html.

Emit the cached worker assets during load in the inline branch as well, matching the non-inline branch from #23068.

@btea
btea requested review from sapphi-red and shulaoda August 2, 2026 01:44
@sapphi-red

Copy link
Copy Markdown
Member

Instead of adding tests to hmr-full-bundle-mode playground, is it possible to add tests to worker playground? Maybe we need to fix other issues in the playground first though. If that turns out to be hard, we can merge this PR as-is first as well.

@sapphi-red sapphi-red added p2-edge-case Bug, but has workaround or limited in scope (priority) feat: web workers feat: bundled-dev labels Aug 18, 2026
@sapphi-red

Copy link
Copy Markdown
Member

cc @h-a-n-a

@h-a-n-a

h-a-n-a commented Aug 18, 2026

Copy link
Copy Markdown
Member

I don't feel like there's anything that blocks us from adding this to the worker playground.

Maybe we need to fix other issues in the playground first though.

What're the issues you were referring to here?

@sapphi-red

sapphi-red commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

the worker playground is now disabled, so I assumed there are many tests failing

'./playground/worker/__tests__/es/worker-es.spec.ts',
'./playground/worker/__tests__/iife/worker-iife.spec.ts',
'./playground/worker/__tests__/relative-base-iife/worker-relative-base-iife.spec.ts',
'./playground/worker/__tests__/relative-base/worker-relative-base.spec.ts',

@h-a-n-a

h-a-n-a commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

the worker playground is now disabled, so I assumed there are many tests failing

'./playground/worker/__tests__/es/worker-es.spec.ts',
'./playground/worker/__tests__/iife/worker-iife.spec.ts',
'./playground/worker/__tests__/relative-base-iife/worker-relative-base-iife.spec.ts',
'./playground/worker/__tests__/relative-base/worker-relative-base.spec.ts',

I see. I haven't checked these yet. Maybe we should try to enable the test and see if anything fails and use isBundledDev to skip them. But at least we can add the current test there.

@h-a-n-a

h-a-n-a commented Aug 18, 2026

Copy link
Copy Markdown
Member

I tried to enable worker bundled-dev test cases. Unlike other enabled test cases in Vite playground. These cases were not triaged. But I feel like we can remove it from the exclude list first and gradually enable them. #23289 cc @sapphi-red

@sapphi-red

Copy link
Copy Markdown
Member

@btea Would you see if you can enable some tests that is skipped in #23289 after this PR?

@btea

btea commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

I've verified this locally, and it seems I can't enable any of the test cases skipped in #23289.

@sapphi-red
sapphi-red merged commit 5e50bae into vitejs:main Nov 10, 2026
18 checks passed
@btea
btea deleted the fix/bundled-dev-inline-worker-assets branch November 10, 2026 11:02
This was referenced Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: bundled-dev feat: web workers p2-edge-case Bug, but has workaround or limited in scope (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants