From 80b2f679755e7f0e75ec66fe22e05cede9a6cd78 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Sat, 9 May 2020 16:57:30 +0200 Subject: [PATCH] Set a service worker scope --- src/serviceWorkerLoader.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/serviceWorkerLoader.ts b/src/serviceWorkerLoader.ts index 1beef1d..c10f3dc 100644 --- a/src/serviceWorkerLoader.ts +++ b/src/serviceWorkerLoader.ts @@ -67,7 +67,9 @@ export function register(config?: Config) { function registerValidSW(swUrl: string, config?: Config) { navigator.serviceWorker - .register(swUrl) + .register(swUrl, { + scope: window.location.pathname + }) .then((registration) => { registration.onupdatefound = () => { const installingWorker = registration.installing;