feat: explicit PWA update prompt with build stamp
- registerType 'prompt' + skipWaiting/clientsClaim false: new SW waits instead of silently hijacking running sessions - main.ts registers via virtual:pwa-register; onNeedRefresh shows dismissible toast (i18n en/ru/cu) with Update button -> updateSW(true) - No polling — update check only on navigation, zero extra traffic - Settings About shows __BUILD_DATE__ build stamp for remote debugging
This commit is contained in:
1 parent
a005e386a6
commit
f49735b360
5 files changed
+50
-4
No files matched your search
+6
-4
@@ -6,11 +6,10 @@ import { VitePWA } from 'vite-plugin-pwa';
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
tailwindcss(),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
VitePWA({ registerType: 'prompt',
|
||||
workbox: {
|
||||
skipWaiting: true,
|
||||
clientsClaim: true,
|
||||
skipWaiting: false,
|
||||
clientsClaim: false,
|
||||
globPatterns: ['**/*.{js,css,html,woff,png}'],
|
||||
globIgnores: ['**/data/**'],
|
||||
maximumFileSizeToCacheInBytes: 20 * 1024 * 1024,
|
||||
@@ -66,5 +65,8 @@ export default defineConfig({
|
||||
outDir: 'dist',
|
||||
sourcemap: true,
|
||||
},
|
||||
define: {
|
||||
__BUILD_DATE__: JSON.stringify(new Date().toISOString().slice(0, 10)),
|
||||
},
|
||||
publicDir: 'static',
|
||||
});
|
||||
Reference in new issue
Block a user