fix: stale SW chunks serving HTML, PWA cache cleanup, server asset routing

- Server SPA fallback now returns 404 for missing .js/.css assets instead of index.html
- Prevents "Unexpected token '<'" errors from stale chunk URLs
- Serve PWA files (sw.js, workbox, icons) with correct cache headers
- Workbox: cleanupOutdatedCaches, skipWaiting, clientsClaim for instant SW updates
- navigateFallbackDenylist for /api/ routes
- AudioContext comment clarification

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-07 23:08:25 +00:00
co-authored by Claude Opus 4.6
parent 20e9f0f7a2
commit 7d5f4a6b8d
3 changed files with 20 additions and 1 deletions
+4
View File
@@ -28,7 +28,11 @@ export default defineConfig({
},
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,woff,woff2}'],
cleanupOutdatedCaches: true,
skipWaiting: true,
clientsClaim: true,
navigateFallback: '/index.html',
navigateFallbackDenylist: [/^\/api\//],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,