sw: exclude licenses from precache
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/953/head
parent
98740af645
commit
75f7c969de
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue