This commit is contained in:
seb
2026-10-05 16:09:23 +02:00
parent bac2d9a202
commit 5c48d1be65
6 changed files with 293 additions and 29 deletions

View File

@@ -289,12 +289,9 @@ export default defineConfig(({ command }) => ({
...(command === 'build'
? [
VitePWA({
// autoUpdate: the SW calls clientsClaim()/skipWaiting() itself, so a
// new build takes over every open tab on its own.
registerType: 'autoUpdate',
// Registration is done explicitly in src/main.jsx via
// `virtual:pwa-register` with `immediate: true`; that is what makes
// the *page* reload (a bare injected script only swaps the SW).
// prompt: new service worker waits in the background until the user
// confirms update via the PWA update dialog.
registerType: 'prompt',
injectRegister: false,
manifest: {
id: '/',
@@ -325,12 +322,6 @@ export default defineConfig(({ command }) => ({
],
},
workbox: {
// NOTE: vite-plugin-pwa only auto-sets these two when
// injectRegister === 'auto'. Because we register manually in
// src/main.jsx (injectRegister: false), they must be explicit —
// otherwise a new SW waits forever behind the old one and no tab
// is ever claimed.
skipWaiting: true,
clientsClaim: true,
globPatterns: ['**/*.{js,css,html,ico,png,svg,webmanifest,woff2}'],
globIgnores: ['**/*.wasm'],