Links to static files should not be handled by Sveltekit
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
When linking to a file in the static directory and there is a [...path] route defined this route tries to handle the static link rather than letting the browser handle the link.
I think it would make sense to include static files in the manifest and when a link points to one then Sveltekit should not try to handle the link itself and should let the browser handle it.
Adding data-sveltekit-reload to the link avoids the problem but is a burden on the developer to remember to do it when linking to static files.
Reproduction
https://stackblitz.com/edit/sveltejs-kit-template-default-5zqccl?file=src/routes/+page.svelte
Logs
No response
System Info
System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 240.78 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.volta/tools/image/node/18.15.0/bin/node
Yarn: 3.3.0 - ~/.volta/tools/image/yarn/3.3.0/bin/yarn
npm: 9.5.0 - ~/.volta/tools/image/npm/9.5.0/bin/npm
Browsers:
Chrome: 111.0.5563.64
Firefox: 110.0.1
Safari: 16.3
npmPackages:
@sveltejs/adapter-vercel: ^2.0.2 => 2.3.1
@sveltejs/kit: ^1.0.0 => 1.11.0
svelte: ^3.44.0 => 3.56.0
vite: ^4.0.0 => 4.1.4
Severity
serious, but I can work around it
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and inspect src/routes/+page.svelte, then trace how SvelteKit handles links when a [...path] route and a static file are present. Done means links to files in static are handled by the browser instead of the catch-all route, without requiring data-sveltekit-reload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100