From 826ce6c884bc41a2579028b3d25de0d4d4647f0f Mon Sep 17 00:00:00 2001 From: Niko Date: Sat, 12 Jul 2025 11:28:54 +0200 Subject: [PATCH] Update service workers config --- astro.config.mjs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/astro.config.mjs b/astro.config.mjs index 349928aff..a629bd872 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -153,7 +153,27 @@ export default defineConfig({ mdx(), svelte(), serviceWorker({ - workbox: { inlineWorkboxRuntime: true }, + workbox: { + inlineWorkboxRuntime: true, + runtimeCaching: [ + { + urlPattern: + /\.(?:js|css|json|png|jpg|jpeg|svg|woff2?|ttf|eot|gif)$/, + handler: "CacheFirst", + options: { + cacheName: "assets-cache", + expiration: { + maxEntries: 100, + maxAgeSeconds: 60 * 60 * 1, // 1h + }, + }, + }, + { + urlPattern: /\.html$/, + handler: "NetworkOnly", // ⛔ Don't cache HTML + }, + ], + }, }), ...(fastBuild ? []