Skip to content

🐛 SvelteKit's src/service-worker.{ts,js} is marked as unused #1162

Open
@gwennlbh

Description

@gwennlbh

Prerequisites

Reproduction url

https://stackblitz.com/edit/vitejs-vite-xdzv7lv3?file=src%2Fservice-worker.ts

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

The file src/service-worker.ts, which is special-cased in sveltekit as a auto-registered service worker, is reported as unused by knip.

Moreover, any exported function that is only used in the service worker is reported as unused

Just run npm run knip in a terminal in the repro link. Relevant files are src/service-worker.ts and src/lib/exported.ts

See https://svelte.dev/docs/kit/service-workers

Oh and also, $service-worker is not resolved properly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions