From f881caf794112c4cb9aa018f9c695885574ccaae Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 19 Nov 2025 19:08:04 +0530 Subject: [PATCH] chore(pwa): config workbox to skip precaching next.js internal files (#2478) --- apps/readest-app/next.config.mjs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/next.config.mjs b/apps/readest-app/next.config.mjs index 12856f2f..55cfde56 100644 --- a/apps/readest-app/next.config.mjs +++ b/apps/readest-app/next.config.mjs @@ -66,7 +66,8 @@ const nextConfig = { const withPWA = withPWAInit({ dest: 'public', disable: isDev || appPlatform !== 'web', - buildExcludes: [/\/_headers$/], + cacheStartUrl: false, + dynamicStartUrl: false, cacheOnFrontEndNav: true, aggressiveFrontEndNavCaching: true, reloadOnOnline: true, @@ -76,6 +77,23 @@ const withPWA = withPWAInit({ }, workboxOptions: { disableDevLogs: true, + manifestTransforms: [ + (manifestEntries) => { + const manifest = manifestEntries.filter((entry) => { + const url = entry.url; + return ( + !url.includes('dynamic-css-manifest.json') && + !url.includes('middleware-manifest.json') && + !url.includes('react-loadable-manifest.json') && + !url.includes('build-manifest.json') && + !url.includes('_buildManifest.js') && + !url.includes('_ssgManifest.js') && + !url.includes('_headers') + ); + }); + return { manifest }; + }, + ], }, });