Skip to content

Imported worker missing from Vite build manifest #23377

Closed

Description

@teemingc

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.2

Used 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

Activity

  1. added theissue type on Aug 26, 2026
  2. DaZuiZui commented on Aug 27, 2026

    @DaZuiZui
    Contributor

    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 its originalFileName metadata 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 from manifest.json.

    The fix preserves the worker bundle/chunk source metadata and passes originalFileName when emitting the asset. The worker is then included in the corresponding manifest entry's assets array, 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.

  3. added
    p3-downstream-blocker
    and removed on Oct 8, 2026
  4. locked and limited conversation to collaborators on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: buildfeat: web workersp3-downstream-blocker

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions