fix: use absolute paths for service worker registration

SvelteKit sets Vite's base to './' for client builds, causing the PWA
plugin to generate relative SW paths (./sw.js). On sub-routes like
/settings or /tag/foo, this resolves to /settings/sw.js which returns
HTML, breaking SW registration. Force scope and buildBase to '/'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Frederic Cabassut
2026-03-12 23:11:56 +01:00
co-authored by Claude Opus 4.6
parent fe034f4f98
commit f8937d287d
+2
View File
@@ -23,6 +23,8 @@ export default defineConfig({
]
: []),
SvelteKitPWA({
scope: '/',
buildBase: '/',
registerType: 'autoUpdate',
manifest: {
name: 'Crumbs by Bretzel',