From f7a0e2c77f96742900da82a192d182efdc672a40 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Thu, 18 Jul 2024 18:16:04 +0200 Subject: [PATCH] fix(pwa): :bug: path precaching of pages (`/routes/*/index.tsx`) --- routes/api/serviceworker/precache.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routes/api/serviceworker/precache.tsx b/routes/api/serviceworker/precache.tsx index bd9425e..9b53d5a 100644 --- a/routes/api/serviceworker/precache.tsx +++ b/routes/api/serviceworker/precache.tsx @@ -24,7 +24,8 @@ export const handler: SessionHandlers = { for await (const route of expandGlob(routes, { root: '.' })) { if (!route.isFile) continue //@ts-expect-error parentPath is missing from type definition - preCachedUrls.push(strip(routes, route.parentPath)) + const path = route.parentPath as string + preCachedUrls.push(path.replace('routes', '').replace('\\', '/')) } // Pre-cache files