-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Describe the bug
Hi community,
I'm using https://github.com/cloudflare/templates/tree/main/vite-react-template to create a project.
And try to introduce tanstack router in it, for file-based routing.
Since I'm building an mobile-first app, so I need to test in my real phone.
I used pnpm dev --host i.e. vite --host to expose network access from my computer, so that my phone can use my computer's IP and port to visit the website.
However, when I visit the network address, and route to the about page, and then do a hard refresh (press F5), the app throws a 404 error.
But when using localhost:5173, there's no such problem. Only using the IP will cause this problem.
BTW, pnpm preview --host will cause this issue as well. Seems something wrong with --host function.
Since this template involves Vite + React + Cloudflare Workers + Tanstack Router, I really have no idea which part is causing this problem.
Can you help me troubleshoot this issue? Thank you so much.
Reproduction
https://github.com/KyleRicardo/vite-tanstack-router-template
Steps to reproduce
- Clone my minimal reproduction repo.
- You may need to delete
pnpm-lock.jsonfirst to get Cloudflare'sworkerdworking for your machine's arch. - Run
pnpm install - Use
pnpm dev --hostto start dev server - Use
<your_local_ip>:5173to visit the dev website - Use the about button to navigate to about page
- Refresh the page, and you will get 404 Not Found error message
System Info
System:
OS: macOS 15.1
CPU: (8) arm64 Apple M1
Memory: 184.05 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - /Users/kylericardo/.local/share/mise/installs/node/22.14.0/bin/node
npm: 11.2.0 - /Users/kylericardo/.local/share/mise/installs/node/22.14.0/bin/npm
pnpm: 10.10.0 - /Users/kylericardo/.local/share/mise/installs/node/22.14.0/bin/pnpm
Browsers:
Chrome: 143.0.7499.170
Firefox: 127.0.2
Safari: 18.1
npmPackages:
@vitejs/plugin-react: 5.1.1 => 5.1.1
vite: ^6.0.0 => 6.4.1Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.