Fix infinite reload when context path isn't root in localhost (#744)

This commit is contained in:
yaling888 2023-02-25 13:40:22 +08:00 committed by GitHub
parent 8337591a66
commit 8334d36f34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.