add PWA update from change version

This commit is contained in:
2026-09-17 04:45:16 +03:00
parent 3a949e1099
commit 717d575848
5 changed files with 282 additions and 55 deletions

View File

@ -19,9 +19,28 @@ export default defineConfig({
}
}),
VitePWA({
registerType: 'autoUpdate',
registerType: 'prompt',
injectRegister: 'auto',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,wasm}']
globPatterns: ['**/*.{js,css,html,ico,png,svg,wasm}'],
// Важно: не кэшируем API endpoint версии
navigateFallbackDenylist: [/^\/api\/version/],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // 1 год
},
cacheableResponse: {
statuses: [0, 200]
}
}
}
]
},
manifest: {
name: 'UnitPrint',
@ -29,12 +48,17 @@ export default defineConfig({
start_url: '/',
display: 'standalone',
background_color: '#ffffff',
theme_color: '#ff3e00',
theme_color: '#6366f1',
icons: [
{
src: '/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}