Service worker caching strategy
Precache the shell, JS, CSS and self-hosted fonts in mealquest-precache-v1. Route every other request through the pure src/sw/routes.ts decision: NetworkFirst (3 s timeout) for plans, shopping, dinners and home; CacheFirst with expiration for /media/* and font files; NetworkOnly for /auth/*, settings, jobs and every non-GET. App navigations fall back to the precached index.html offline. On activate, delete only stale caches named mealquest-*. Maestro task: 8fa0d0bd-4a52-4f09-ba68-41bdbdfda63b Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,8 @@ export default defineConfig({
|
||||
srcDir: 'src',
|
||||
filename: 'sw.ts',
|
||||
injectRegister: 'script',
|
||||
// Precache the shell, JS, CSS and the self-hosted fonts.
|
||||
injectManifest: { globPatterns: ['**/*.{html,js,css,woff2}'] },
|
||||
// The web manifest lives in manifest.json: its theme and background
|
||||
// colours are --color-accent and --color-bg from src/styles/tokens.css,
|
||||
// and hex colours may not be written in TypeScript.
|
||||
|
||||
Reference in New Issue
Block a user