// Minimal service worker — present so Chrome's PWA install criteria // pass and the beforeinstallprompt event fires. Real offline caching // is intentionally out of scope; we don't pre-cache the SPA shell or // intercept fetches in any meaningful way. // // Lives at /sw.js (document root, not /build/sw.js) so its default // scope is /, matching the manifest's "scope": "/". Don't move it // without setting Service-Worker-Allowed: / on the response. self.addEventListener('install', () => { // Activate immediately, don't wait for old tabs to close self.skipWaiting() }) self.addEventListener('activate', (event) => { // Take control of all clients (including ones that loaded before // this SW activated) so subsequent navigations go through us. event.waitUntil(self.clients.claim()) }) self.addEventListener('fetch', () => { // Passthrough — we don't call event.respondWith(), so the browser // proceeds with its normal network fetch. The handler existing at // all is what Chrome's PWA install heuristic looks for. })