dev: register the dev service worker as an ES module so it actually loads
CI / Build & Quality Checks (push) Successful in 1m30s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 8s
CI / Trigger Desktop Build (push) Successful in 9s
CI / Playwright smoke (e2e) (push) Successful in 2m53s

vite-plugin-pwa's dev-sw.js imports workbox as a module; registering it
as a classic script failed with 'script evaluation failed', leaving the
dev client with no SW — authenticated media 401'd (broken images in every
dev screenshot) and SW notification routing was untestable. Production
sw.js is unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-09-18 19:59:02 -04:00
co-authored by Claude Opus 5
parent b38621861b
commit 6460d0569c
+7 -1
View File
@@ -33,7 +33,13 @@ if ('serviceWorker' in navigator) {
pushSessionToSW(session?.baseUrl, session?.accessToken);
};
navigator.serviceWorker.register(swUrl).then(sendSessionToSW);
// The dev worker is an ES module (it imports workbox), so it must be
// registered as one — otherwise "script evaluation failed" and the dev
// client has no SW: authenticated media 401s and notification clicks
// never route. Production sw.js is a classic bundled script.
navigator.serviceWorker
.register(swUrl, import.meta.env.MODE === 'production' ? undefined : { type: 'module' })
.then(sendSessionToSW);
navigator.serviceWorker.ready.then(sendSessionToSW);
navigator.serviceWorker.addEventListener('message', (ev) => {