Skip to content

[Bug]: v7pre - Can't use vite preview with SPA + basename + prerender #12083

Open
@daniharo

Description

@daniharo

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions