💡 You can use Yarn or pnpm as alternatives to npm
cp .env.example .env
npm ci
npm run setup
💡 Avoid using preview in production environments.
- Build
npm run build
- preview
npm run preview
- build
npm run build
- serve
build/client/
You can serve build/client/
using nginx, serve, sirv-cli...etc.
- Setup
- react-router.config.ts
import type { Config } from "@react-router/dev/config";
export default {
prerender: true,
- ssr: false,
+ ssr: true,
} satisfies Config;
- package.json
+ "start": "react-router-serve ./build/server/index.js",
- install @react-router/serve
npm i @react-router/serve
- playwright.config.ts
webServer: {
- command: process.env.CI ? 'npm run start' : 'npm run dev',
+ command: process.env.CI ? 'npm run preview' : 'npm run dev',
- build
npm run build
- serve
npm run start