From 8334d36f34ef4402b9908e9b2c76306d59e1a40e Mon Sep 17 00:00:00 2001 From: yaling888 <73897884+yaling888@users.noreply.github.com> Date: Sat, 25 Feb 2023 13:40:22 +0800 Subject: [PATCH] Fix infinite reload when context path isn't root in localhost (#744) --- src/swRegistration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swRegistration.ts b/src/swRegistration.ts index 0a684a8..927cba6 100644 --- a/src/swRegistration.ts +++ b/src/swRegistration.ts @@ -23,7 +23,7 @@ export function register(config?: Config) { } window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/sw.js`; + const swUrl = `./sw.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not.