Files
Michael BiancoandGitHub 0be8db4ab1 fix(node): react router spa detection (#604)
* chore: update react router to v8 and modernize node infrastructure

- Bump React Router to v8.0.0 and update associated dependencies.
- Upgrade Node.js base image to v24.
- Simplify TSConfig and Vite configuration by utilizing native TSConfig path resolution.
- Add .env to gitignore.
- Ensure consistent scripting and environment settings across SPA and SSR examples.

Generated-by: aiautocommit

* feat(node): detect React Router SPA mode from config

Generated-by: aiautocommit

* test(node): improve React Router SPA detection and handling

Generated-by: aiautocommit

* chore(deps): update mise.dev.lock

Generated-by: aiautocommit

* docs(node): clarify SPA detection limitation and manual override

Generated-by: aiautocommit

* test(node): bind React Router preview server to IPv4 in SPA example

- Force preview host to 127.0.0.1 in Vite config and generation script.
- Prevent connection mismatch issues between prerender requests and the preview server.

Generated-by: aiautocommit
2026-07-23 12:34:14 -06:00

19 lines
629 B
Bash

#!/usr/bin/env zsh
# Description: autogen this repo from the latest version of the RR template
cd "${0:A:h}"
pnpx create-react-router@latest . --yes --overwrite --no-git-init
# disable SSR for SPA build
sed -i '' 's/ssr: true/ssr: false/' react-router.config.ts
# Pin the build-time preview server to IPv4 until React Router connects to its bound address.
# https://github.com/remix-run/react-router/issues/15255
sed -i '' '/plugins: \[tailwindcss(), reactRouter()\],/a\
// Keep React Router'\''s preview server and prerender request on the same address family.\
preview: {\
host: "127.0.0.1",\
},
' vite.config.ts