Merge pull request #753 from everyx/master

fix: infinite refreshing when host at subpath
This commit is contained in:
haishan 2023-03-25 13:40:21 +08:00 committed by GitHub
commit e533e8e959
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', () => { 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.