This commit is contained in:
2026-09-18 20:24:45 +03:00
parent 623478bff0
commit 51d86d49e3
5 changed files with 552 additions and 520 deletions

View File

@ -8,8 +8,8 @@ export default defineConfig({
svelte({
onwarn(warning, handler) {
if (
warning.code.startsWith('a11y_') ||
warning.code === 'slot_element_deprecated' ||
warning.code.startsWith('a11y_') ||
warning.code === 'slot_element_deprecated' ||
warning.code === 'svelte_self_deprecated' ||
warning.code === 'non_reactive_update'
) {
@ -22,9 +22,9 @@ export default defineConfig({
registerType: 'prompt',
injectRegister: 'auto',
workbox: {
clientsClaim: true, // Необходимо для PDF SW
globPatterns: ['**/*.{js,css,html,ico,png,svg,wasm}'],
// Важно: не кэшируем API endpoint версии
clientsClaim: true,
// Добавили mjs, чтобы pdf.worker.min.mjs попадал в precache Нужно для PDFJS
globPatterns: ['**/*.{js,mjs,css,html,ico,png,svg,wasm}'],
navigateFallbackDenylist: [/^\/api\/version/],
runtimeCaching: [
{
@ -34,12 +34,21 @@ export default defineConfig({
cacheName: 'google-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // 1 год
maxAgeSeconds: 60 * 60 * 24 * 365
},
cacheableResponse: {
statuses: [0, 200]
}
}
},
// Fallback кэширование для worker-файлов, если они не попали в precache
{
urlPattern: /\/assets\/.*\.(mjs|js)$/,
handler: 'CacheFirst',
options: {
cacheName: 'worker-cache',
expiration: { maxEntries: 20, maxAgeSeconds: 60 * 60 * 24 * 30 }
}
}
]
},