react-router
react-router copied to clipboard
[Bug]: v7pre - Can't use vite preview with SPA + basename + prerender
What version of React Router are you using?
7.0.0-pre.0
Steps to Reproduce
- Enable SPA mode (
ssr: false
) - Set the basename to /chat/
- Enable prerender.
- Build the app with
npm run build
- Run
vite preview
.
Minimal reproduction (run npm run build
+ npm run preview
on it):
https://stackblitz.com/edit/react-router-v7-basename-prerender-preview?file=vite.config.ts
Expected Behavior
When opening http://localhost:4173/chat/, the preview server responds with /build/client/chat/index.html and the root route is rendered.
Actual Behavior
There is a 404 error response. When opening http://localhost:4173/chat/, vite tries to respond with the file /build/client/index.html which doesn't exist (the prerendered route is in /build/client/chat/index.html), so there is a 404 response.