vite
vite copied to clipboard
Route named `home` is substantially slower in both SvelteKit, Astro, and possibly other frameworks (in dev mode)
Describe the bug
For some reason, if you create a route named home
, it will take much longer to load than any other route (For example /test
and containing the same content). This has been reproduced with both SvelteKit and Astro frameworks) in dev
mode.
Note: This issue does not exist in production/preview (built/compiled) sites.
I've created an issue thread in the SvtelteKit repo for this issue https://github.com/sveltejs/kit/issues/12061#issuecomment-2067835993. I figured this was a SvelteKit issue at first, but it looks like this may be related to Vite (as user amit13k points out in the comment above)
If you're apart of the SvelteKit Discord, you can see our conversation here regarding the bug: https://discord.com/channels/457912077277855764/1223280626724241439
This issue seems to definitely affect Mac users. I've had 1 user say that they weren't affected on Linux, however another has said that they had the issue on Windows.
Reproduction
You can use my repo below, or just use the quickstart commands to create a project for both SvelteKit and Astro (included below) https://github.com/dihmeetree/svelte-bug-repro
Steps to reproduce
You can create a SvelteKit project quickly via the following command
npm create svelte@latest my-app
In SvelteKit create a route (folder) named home
, and create a +page.svelte
file inside it. Put some html in it and then load the /home
route in your browser. Create a /test
folder as well. The /home
route will load much slower than the /test
route.
And for Astro
npm create astro@latest
In Astro create a home.astro
file in the pages
directory. It will be much slower than your index.astro
file.
I've tested with npm
, yarn
, and bun
to make sure it wasn't an issue with a package manager as well.
System Info
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 19.58 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.0 - /usr/local/bin/node
npm: 10.5.0 - /usr/local/bin/npm
bun: 1.1.3 - /usr/local/bin/bun
Browsers:
Chrome: 124.0.6367.61
Safari: 17.4.1
Used Package Manager
bun
Logs
No logs that are relevant to the issue.
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
I haven't looked into the issue much yet, but if accessing /home
once is really slow, we might need to skip it on MacOS. Otherwise if it's only slow in repeated access, we might need to check if it's a caching issue so we only do it once.
Any updates on this? 👀
@dihmeetree I just noticed the same issue! Spent an hour trying to figure out why my Astro site was super fast except for the /home
route. Renamed it to /home2
for testing, and it went back to normal Astro fast interactivity. Finally updated the site to point to /
for the homepage.
My app details:
- Framework: Astro
4.12.2
- Render Strategy: SSR (
output: "server"
) - View Transitions: enabled (Default animations)
@dihmeetree I just noticed the same issue! Spent an hour trying to figure out why my Astro site was super fast except for the
/home
route. Renamed it to/home2
for testing, and it went back to normal Astro fast interactivity. Finally updated the site to point to/
for the homepage.My app details:
- Framework: Astro
4.12.2
- Render Strategy: SSR (
output: "server"
)- View Transitions: enabled (Default animations)
Yeah hoping this will be fixed! 😄 Definitely an annoyance... haha. Thanks for sharing your app details!