Skip to content

Commit 4cf65ce

Browse files
committed
feat: allow hosting hash-based apps from html files other than index.html
Fixes #14824.
1 parent 102aecf commit 4cf65ce

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.changeset/upset-parents-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': minor
3+
---
4+
5+
feat: allow hosting hash-based apps from non-index.html files

packages/kit/src/runtime/client/utils.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,11 @@ export function is_external_url(url, base, hash_routing) {
317317
}
318318

319319
if (hash_routing) {
320-
if (url.pathname === base + '/' || url.pathname === base + '/index.html') {
321-
return false;
322-
}
323-
324-
// be lenient if serving from filesystem
325-
if (url.protocol === 'file:' && url.pathname.replace(/\/[^/]+\.html?$/, '') === base) {
320+
if (
321+
url.pathname === base + '/' ||
322+
url.pathname === base + '/index.html' ||
323+
url.pathname.replace(/\/[^/]+\.html?$/, '') === base
324+
) {
326325
return false;
327326
}
328327

0 commit comments

Comments
 (0)