Skip to content

Prerendering with ssr: false does not work correctly when a basename is set #13615

Open
@wonu

Description

@wonu

I'm using React Router as a...

framework

Reproduction

  1. npx create-react-router@latest my-react-router-app
  2. modify react-router.config.ts
    • ssr: false
    • prerender: true
  3. npm run build
    • build/client/__spa-fallback.html: 2.19kB
    • build/client/index.html: 6.71kB
  4. set basename and rebuild
    • build/client/__spa-fallback.html: 2.2kB
    • build/client/fake-base/index.html: 2.2kB (the two files are identical)

System Info

System:
  OS: Windows 11 10.0.22631
Binaries:
  Node: 22.10.0
  npm: 10.9.0
npmPackages:
  @react-router/dev: ^7.5.3 => 7.6.0
  @react-router/node: ^7.5.3 => 7.6.0
  @react-router/serve: ^7.5.3 => 7.6.0
  react-router: ^7.5.3 => 7.6.0
  vite: ^6.3.3 => 6.3.5

I tested it on WSL(Ubuntu 22) as well, and it was the same.

Used Package Manager

npm

Expected Behavior

Shouldn't prerendering work even if a basename is set?

Actual Behavior

If a basename is set, prerendering becomes ineffective.
This seems to have occurred since v7.2.0, which is when 'Prerendering with a SPA Fallback' was added.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions