Remove screenshots from SW Cache
This commit is contained in:
parent
4526cfa3e0
commit
78fc63fe29
@ -6,10 +6,18 @@ const cacheName = `ob-${version}`;
|
||||
|
||||
const assets = [...build, ...files, "/service-worker.js"];
|
||||
|
||||
const excludePatterns = [
|
||||
"/static/images/screnshots/",
|
||||
"/images/screenshots",
|
||||
];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
async function addToCache() {
|
||||
const cache = await caches.open(cacheName);
|
||||
await cache.addAll(assets);
|
||||
const assetsToCache = assets.filter(asset => {
|
||||
return !excludePatterns.some(pattern => asset.startsWith(pattern));
|
||||
});
|
||||
await cache.addAll(assetsToCache);
|
||||
}
|
||||
|
||||
event.waitUntil(addToCache());
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
import adapter from "@sveltejs/adapter-static";
|
||||
import { vitePreprocess } from "@sveltejs/kit/vite";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user