fix: infinite refreshing when host at subpath

Close: #751
This commit is contained in:
everyx 2023-03-23 23:27:00 +08:00
parent 2236c0da31
commit 16c8651cdb

View file

@ -23,7 +23,7 @@ export function register(config?: Config) {
} }
window.addEventListener('load', () => { window.addEventListener('load', () => {
const swUrl = `./sw.js`; const swUrl = new URL('sw.js', publicUrl.href).href;
if (isLocalhost) { if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not. // This is running on localhost. Let's check if a service worker still exists or not.