From 536372d895263ec5bf2fbfa879f77dceb4051ef1 Mon Sep 17 00:00:00 2001 From: ayoayco Date: Sun, 25 Aug 2024 13:44:26 +0200 Subject: [PATCH] refactor: simpler ssr step --- astro-sw.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/astro-sw.js b/astro-sw.js index 49fd3c2..7ec6ddc 100644 --- a/astro-sw.js +++ b/astro-sw.js @@ -122,12 +122,10 @@ declare const __prefix: string;` injectTypes({filename: 'caching.d.ts', content: injectedTypes}) }, 'astro:build:ssr': ({ manifest }) => { - const files = manifest.routes.map(route => route.file.replaceAll('/', '')); - const assetsMinusFiles = manifest.assets.filter(ass => !files.includes(ass.replaceAll('/', ''))); - assets = output === 'static' - ? assetsMinusFiles - : manifest.assets.filter(ass => !ass.includes('sw.js')); + if (output !== 'static') { + assets = manifest.assets + } }, 'astro:build:done': async ({ dir, routes, pages, logger }) => { const outfile = fileURLToPath(new URL('./sw.js', dir));