Merge pull request 'Fix PDFs still failing on browsers that used the old build' (#5) from sw-bypass-http-cache into main

Reviewed-on: https://git.srazka.com/reudy-net/Papure/pulls/5
This commit is contained in:
reudy 2026-09-27 12:18:03 +02:00
commit 964b3b1cdd

View file

@ -16,7 +16,9 @@ sw.addEventListener('install', (event) => {
event.waitUntil(
caches
.open(CACHE)
.then((c) => c.addAll(ASSETS))
// Bypass the HTTP cache: hashed assets are cached as immutable, so a bad
// response (e.g. a wrong MIME type) would otherwise be copied in forever.
.then((c) => c.addAll(ASSETS.map((url) => new Request(url, { cache: 'reload' }))))
.then(() => sw.skipWaiting())
);
});