u
This commit is contained in:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user