Deploy React on WebStadia
Deploy React apps built with Vite (or Create React App) on WebStadia.
Build settings
Vite
| Setting | Value |
|---|---|
| Build Command | npm run build |
| Publish Directory | dist |
Create React App
| Setting | Value |
|---|---|
| Build Command | npm run build |
| Publish Directory | build |
SPA routing
React apps use client-side routing. To make direct URL access work (e.g., /about), your site needs to serve index.html for all routes.
WebStadia handles this automatically for single-page applications.
Environment variables
For Vite, prefix environment variables with VITE_:
VITE_API_URL=https://api.example.com
Access in code:
const apiUrl = import.meta.env.VITE_API_URL