-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
When using the hash router on a page that's not hosted at index.html, SvelteKit 404s unless it's from a file:// URL.
I'm trying to integrate SvelteKit into WXT make it "easy" to write Web Extensions using Svelte, but it wants to host it from /popup.html.
Reproduction
I tried to write a repro, but because it relies on tweaking the build output, not sure what the best way to demonstrate it, beyond that it's clearly intentional from the code.
kit/packages/kit/src/runtime/client/utils.js
Lines 324 to 325 in 102aecf
| // be lenient if serving from filesystem | |
| if (url.protocol === 'file:' && url.pathname.replace(/\/[^/]+\.html?$/, '') === base) { |
I'm more than happy to write one, I don't know how to write one for this.
Logs
bundle.D7L2dPMx.js:65 The next HMR update will cause the page to reload
console.warn @ bundle.D7L2dPMx.js:65
bundle.D7L2dPMx.js:65 sn: Not found: /popup.html (did you forget the hash?)
at st (bundle.D7L2dPMx.js:64:7969)
at async ml (bundle.D7L2dPMx.js:64:485)
handleError @ bundle.D7L2dPMx.js:65System Info
System:
OS: macOS 15.7.1
CPU: (10) arm64 Apple M4
Memory: 90.95 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.10.0 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 11.6.0 - /opt/homebrew/bin/npm
pnpm: 10.19.1-oidc-test.3 - /opt/homebrew/bin/pnpm
Deno: 2.5.4 - /opt/homebrew/bin/deno
Watchman: 2025.10.20.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 141.0.7390.123
Safari: 26.0.1Severity
serious, but I can work around it
Additional Information
I've patched it locally, happy to contribute it.
I'm actually running Ungoogled-Chromium & Zen Twilight to debug, but envinfo isn't aware of those.