Repository navigation
Description
Describe the bug
Vite handles imported workers and these show up when building an app (as shown in the last line of the following logs):
vite v8.2.1 building client environment for production...
✓ 1502 modules transformed.
computing gzip size...
.svelte-kit/output/client/_app/immutable/assets/example.kaL65i_D.json 0.01 kB │ gzip: 0.03 kB
.svelte-kit/output/client/_app/version.json 0.02 kB │ gzip: 0.04 kB
.svelte-kit/output/client/_app/immutable/workers/worker-CligqNjd.js 0.11 kB
However, the worker isn't included in the Vite build manifest. SvelteKit uses the build manifest to collect assets which the app may want to cache as part of their service worker strategy (illustrated in the docs).
Reproduction
https://github.com/teemingc/vite-worker-manifest-repro
Steps to reproduce
Instructions are in the README.md of the reproduction
System Info
System:
OS: macOS 27.0
CPU: (8) arm64 Apple M1 Pro
Memory: 917.61 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.18.0 - /Users/teeming/Library/pnpm/bin/node
Yarn: 1.22.22 - /Users/teeming/Library/pnpm/bin/yarn
npm: 11.18.0 - /Users/teeming/Library/pnpm/bin/npm
pnpm: 11.22.0 - /Users/teeming/Library/pnpm/bin/pnpm
bun: 1.4.0 - /opt/homebrew/bin/bun
Deno: 2.8.2 - /Users/teeming/.deno/bin/deno
npmPackages:
vite: ^8.2.2 => 8.2.2Used Package Manager
pnpm
Logs
❯ pnpm build
$ tsc && vite build
vite v8.2.2 building client environment for production...
✓ 5 modules transformed.
computing gzip size...
dist/assets/worker-CS9v0tXh.js 0.04 kB
dist/.vite/manifest.json 0.13 kB │ gzip: 0.11 kB
dist/index.html 0.38 kB │ gzip: 0.26 kB
dist/assets/index-xI8nRDUE.js 0.77 kB │ gzip: 0.45 kB
✓ built in 37ms
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Activity
DaZuiZui commentedon Aug 27, 2026
Confirmed this is a Vite bug. I opened a fix in PR #23384.
The worker file is emitted to
dist/assets, but the worker asset loses itsoriginalFileNamemetadata when it is emitted into the main build. Rolldown's manifest plugin uses that metadata to associate assets with their importing entry, so the worker was omitted frommanifest.json.The fix preserves the worker bundle/chunk source metadata and passes
originalFileNamewhen emitting the asset. The worker is then included in the corresponding manifest entry'sassetsarray, which allows SvelteKit and other integrations to discover and cache it.Verification: the reproduction now lists the worker in
manifest.json; Vite type-check and build pass; a regression test was added. Browser E2E was not run because Playwright Chromium is not installed in the local environment.AI assistance was used during the investigation and drafting. I reviewed the generated changes, verified the root cause against the Vite/Rolldown build flow, and ran the checks described above.