서비스워커 자산 캐시 제거

This commit is contained in:
seo
2026-07-21 19:15:33 +09:00
parent 6215139136
commit cf5fe5b050
6 changed files with 32 additions and 32 deletions
+5 -16
View File
@@ -1,13 +1,6 @@
const CACHE_NAME = 'financial-static-v1';
const CACHE_NAME = 'financial-offline-v20260721-nocache1';
const STATIC_ASSETS = [
'/offline.html',
'/assets/vendor/bootstrap.min.css',
'/assets/vendor/bootstrap.bundle.min.js',
'/assets/vendor/chart.umd.js',
'/assets/app.css',
'/assets/pwa.js',
'/favicon.png?v=2',
'/manifest.webmanifest'
'/offline.html'
];
self.addEventListener('install', event => {
@@ -45,16 +38,12 @@ self.addEventListener('fetch', event => {
return;
}
if (url.pathname.startsWith('/assets/vendor/') || url.pathname === '/assets/app.css' || url.pathname === '/assets/pwa.js' || url.pathname === '/manifest.webmanifest' || url.pathname === '/favicon.png') {
if (request.mode === 'navigate') {
event.respondWith(
caches.match(request).then(cached => cached || fetch(request))
fetch(request, { cache: 'no-store' }).catch(() => caches.match('/offline.html'))
);
return;
}
if (request.mode === 'navigate') {
event.respondWith(
fetch(request).catch(() => caches.match('/offline.html'))
);
}
event.respondWith(fetch(request, { cache: 'no-store' }));
});