diff --git a/.gitignore b/.gitignore index 7800c23..216e636 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ node_modules yarn.lock cypress/screenshots templates/.* -dist +export +build app/manifest \ No newline at end of file diff --git a/app/service-worker.js b/app/service-worker.js index 542371d..dca8106 100644 --- a/app/service-worker.js +++ b/app/service-worker.js @@ -26,7 +26,7 @@ self.addEventListener('activate', event => { if (key !== ASSETS) await caches.delete(key); } - await self.clients.claim(); + self.clients.claim(); }) ); }); @@ -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; } diff --git a/app/template.html b/app/template.html index a7e7d49..5dc665a 100644 --- a/app/template.html +++ b/app/template.html @@ -10,9 +10,9 @@