sw: exclude licenses from precache

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/953/head
Varun Patil 2023-11-24 09:32:18 -08:00
parent 98740af645
commit 75f7c969de
1 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,15 @@ import { ExpirationPlugin } from 'workbox-expiration';
declare var self: ServiceWorkerGlobalScope; declare var self: ServiceWorkerGlobalScope;
precacheAndRoute(self.__WB_MANIFEST); type PrecacheEntry = Exclude<(typeof self.__WB_MANIFEST)[number], string>;
const manifest = self.__WB_MANIFEST as Array<PrecacheEntry>;
// Exclude files that are not needed
const filteredManifest = manifest.filter((entry) => {
return !entry.url?.match(/LICENSE\.txt(\?.*)?$/);
});
precacheAndRoute(filteredManifest);
cleanupOutdatedCaches(); cleanupOutdatedCaches();
registerRoute( registerRoute(