fix: hmr when `base` is set (#2375)

pull/2384/head
烽宁 1 year ago committed by GitHub
parent 0561c8fc41
commit 484ff5dd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -303,6 +303,8 @@ function handleHMR(route: Route): void {
function shouldHotReload(payload: PageDataPayload): boolean {
const payloadPath = payload.path.replace(/(\bindex)?\.md$/, '')
const locationPath = location.pathname.replace(/(\bindex)?\.html$/, '')
const locationPath = location.pathname
.replace(/(\bindex)?\.html$/, '')
.slice(siteDataRef.value.base.length - 1)
return payloadPath === locationPath
}

Loading…
Cancel
Save