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] 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; }