mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-17 12:24:55 +00:00
fix and update service worker
This commit is contained in:
@@ -37,8 +37,11 @@ self.addEventListener('fetch', event => {
|
||||
// don't try to handle e.g. data: URIs
|
||||
if (!url.protocol.startsWith('http')) return;
|
||||
|
||||
// ignore dev server requests
|
||||
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
|
||||
|
||||
// always serve assets and webpack-generated files from cache
|
||||
if (cached.has(url.pathname)) {
|
||||
if (url.host === self.location.host && cached.has(url.pathname)) {
|
||||
event.respondWith(caches.match(event.request));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user