/// declare const self: ServiceWorkerGlobalScope; import { clientsClaim } from 'workbox-core'; import { cleanupOutdatedCaches, precacheAndRoute } from 'workbox-precaching'; // Bump this version to force SW update - changes to this constant change the SW file hash const CACHE_VERSION = '2026-03-06-v1'; // @ts-ignore - __WB_MANIFEST is injected at build time by vite-plugin-pwa precacheAndRoute(self.__WB_MANIFEST); cleanupOutdatedCaches(); // Force immediate activation of new SW self.addEventListener('install', () => { console.log('[SW] Installing, skipping waiting...'); self.skipWaiting(); }); self.addEventListener('activate', () => { console.log('[SW] Activating, claiming clients...'); clientsClaim(); }); // Handle SKIP_WAITING message from client self.addEventListener('message', (event) => { if (event.data?.type === 'SKIP_WAITING') { self.skipWaiting(); } });