fix(ui): register the service worker in production only
Tests · UI / test (push) Successful in 2m19s
Tests · UI / test (pull_request) Successful in 2m25s

SvelteKit's automatic SW registration also runs under `vite dev`, where
the worker intercepted/cached the dev-server e2e suite (42 failures).
Disable auto-registration (kit.serviceWorker.register: false) and
register the worker manually from the root layout guarded by `!dev`, so
`vite dev` and the e2e suite run worker-free while the production build —
and the PWA preview test — still install it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-22 15:56:32 +02:00
parent 04c7f6e68a
commit 11f51944df
2 changed files with 13 additions and 0 deletions
+6
View File
@@ -11,5 +11,11 @@ export default {
fallback: "index.html",
strict: true,
}),
serviceWorker: {
// Registered manually in the root layout for production only.
// SvelteKit's auto-registration also runs under `vite dev`, where
// the worker would intercept and cache the dev-server e2e suite.
register: false,
},
},
};