From 4cf65cec4cd4c5c47b13557986b58d346b21bc92 Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:15:51 -0500 Subject: [PATCH 1/4] feat: allow hosting hash-based apps from html files other than `index.html` Fixes #14824. --- .changeset/upset-parents-sniff.md | 5 +++++ packages/kit/src/runtime/client/utils.js | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .changeset/upset-parents-sniff.md diff --git a/.changeset/upset-parents-sniff.md b/.changeset/upset-parents-sniff.md new file mode 100644 index 000000000000..4e35d486d767 --- /dev/null +++ b/.changeset/upset-parents-sniff.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': minor +--- + +feat: allow hosting hash-based apps from non-index.html files diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js index c233ef9ae52f..b373a2e71d8a 100644 --- a/packages/kit/src/runtime/client/utils.js +++ b/packages/kit/src/runtime/client/utils.js @@ -317,12 +317,11 @@ export function is_external_url(url, base, hash_routing) { } if (hash_routing) { - if (url.pathname === base + '/' || url.pathname === base + '/index.html') { - return false; - } - - // be lenient if serving from filesystem - if (url.protocol === 'file:' && url.pathname.replace(/\/[^/]+\.html?$/, '') === base) { + if ( + url.pathname === base + '/' || + url.pathname === base + '/index.html' || + url.pathname.replace(/\/[^/]+\.html?$/, '') === base + ) { return false; } From f39f15f15df3c189efc6326105e742ff70dff941 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 20 Nov 2025 11:55:17 +0100 Subject: [PATCH 2/4] Update .changeset/upset-parents-sniff.md --- .changeset/upset-parents-sniff.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.changeset/upset-parents-sniff.md b/.changeset/upset-parents-sniff.md index 4e35d486d767..25c2cd62edb7 100644 --- a/.changeset/upset-parents-sniff.md +++ b/.changeset/upset-parents-sniff.md @@ -1,5 +1,5 @@ --- -'@sveltejs/kit': minor +'@sveltejs/kit': patch --- -feat: allow hosting hash-based apps from non-index.html files +fix: allow hosting hash-based apps from non-index.html files From dc4a21ecb39c6e4631c5289a91534060a57052ba Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:17:13 +0100 Subject: [PATCH 3/4] simplify --- packages/kit/src/runtime/client/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js index b373a2e71d8a..7f88dd47b46d 100644 --- a/packages/kit/src/runtime/client/utils.js +++ b/packages/kit/src/runtime/client/utils.js @@ -325,7 +325,7 @@ export function is_external_url(url, base, hash_routing) { return false; } - return true; +return url.pathname !== location.pathname; } return false; From 5a67e55f9248713ce473d6abdc0c77051f6aa0d4 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Thu, 20 Nov 2025 20:18:31 +0100 Subject: [PATCH 4/4] goddammit github ui --- packages/kit/src/runtime/client/utils.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js index 7f88dd47b46d..5c77c80d22f0 100644 --- a/packages/kit/src/runtime/client/utils.js +++ b/packages/kit/src/runtime/client/utils.js @@ -317,15 +317,7 @@ export function is_external_url(url, base, hash_routing) { } if (hash_routing) { - if ( - url.pathname === base + '/' || - url.pathname === base + '/index.html' || - url.pathname.replace(/\/[^/]+\.html?$/, '') === base - ) { - return false; - } - -return url.pathname !== location.pathname; + return url.pathname !== location.pathname; } return false;