Skip to content

SPA mode + basename feature gives match issue in dev and 404 error on build #8712

@ajhaining

Description

@ajhaining

Reproduction

Related to #8145

Dev build issue

  1. Go to https://stackblitz.com/edit/remix-run-remix-7qirzt
  2. Open terminal and see dev build fail with:
<Router basename="/test"> is not able to match the URL "/" because it does not start with the basename, so the <Router> won't render anything.

Production build issue

  1. Open terminal run npm run build and see:
Error: SPA Mode: Received a 404 status code from `entry.server.tsx` while generating the `index.html` file.

System Info

Template generated from SPA mode example using nightly build 0.0.0-nightly-f7c2827-20240207

Used Package Manager

npm

Expected Behavior

  1. Dev SPA mode works without having to set Vite's base value
  2. Production build for SPA works

Actual Behavior

  1. Dev SPA mode fails with:
<Router basename="/test"> is not able to match the URL "/" because it does not start with the basename, so the <Router> won't render anything.
  1. Production build fails with:
Error: SPA Mode: Received a 404 status code from `entry.server.tsx` while generating the `index.html` file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions