sveltejs / sveltejs/kit

`build` variable in $service-worker module does not include web worker files

Open
#12,438 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

service worker vite
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

The build variable in the $service-worker module does not include files within the /build/_app/immutable/workers/ directory. Files from other directories such as /build/_app/immutable/chunks/ and /build/_app/immutable/entry/ are included. This needs to be fixed to cache web worker files.

Reproduction

https://github.com/MoonlightOffice/sveltekit-webworker-cache-issue

Logs

No response

System Info
System:
    OS: Linux 6.6 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (8) arm64 unknown
    Memory: 4.47 GB / 7.75 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 22.3.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.8.1 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^3.0.0 => 3.2.2 
    @sveltejs/adapter-static: ^3.0.2 => 3.0.2 
    @sveltejs/kit: ^2.0.0 => 2.5.18 
    @sveltejs/vite-plugin-svelte: ^3.0.0 => 3.1.1 
    svelte: ^5.0.0-next.1 => 5.0.0-next.174 
    vite: ^5.0.3 => 5.3.3
Severity

serious, but I can work around it

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the service-worker module described in the linked documentation and run the provided sveltekit-webworker-cache-issue reproduction. Trace how the build variable is assembled, compare its handling of chunks and entry files with the _app/immutable/workers directory, and verify that web worker files are included for caching.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.