From 46207cfe108629c9e40c4be38d86ba504914b681 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 27 May 2019 23:27:05 -0400 Subject: [PATCH 1/2] register service worker at relative scope Co-Authored-By: Ian Reinhart Geiser --- packages/web/src/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/src/index.html b/packages/web/src/index.html index 4e8473b5..7928be13 100644 --- a/packages/web/src/index.html +++ b/packages/web/src/index.html @@ -29,7 +29,7 @@ if ("serviceWorker" in navigator) { // Use the window load event to keep the page load performant window.addEventListener("load", () => { - navigator.serviceWorker.register("/service-worker.js"); + navigator.serviceWorker.register('service-worker.js', {scope: './'}); }); } From 9b5a43e4bd4d04a3dc51e55478ab5ccbc13c21a8 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 27 May 2019 23:27:30 -0400 Subject: [PATCH 2/2] use local workbox to simplify csp Co-Authored-By: Ian Reinhart Geiser --- scripts/webpack.client.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/webpack.client.config.js b/scripts/webpack.client.config.js index 31ab2a7e..b3b88570 100644 --- a/scripts/webpack.client.config.js +++ b/scripts/webpack.client.config.js @@ -68,6 +68,7 @@ module.exports = (options = {}) => merge( }) ].concat(prod ? [ new GenerateSW({ + importWorkboxFrom: "local", include: [cachePattern], runtimeCaching: [{ urlPattern: cachePattern,