Vite(React / Vue SPA) deploy guide
Vite SPAs output dist/. The key is the fallback: unknown paths must serve index.html.
- Build
- npm run build
- Output
- dist/
- Official docs
- Vite Deploying a Static Site · Cloudflare Pages SPA rendering
How to deploy
- npm run build and upload dist/.
- Nginx: try_files $uri $uri/ /index.html;
- Netlify: /* /index.html 200 in public/_redirects.
- Cloudflare Pages: treated as an SPA when there is no 404.html.
- GitHub Pages: set Vite base for sub-paths; copy index.html to 404.html as a fallback (returns status 404).
Per platform
| Platform | Notes |
|---|---|
| Cloudflare Pages / Netlify / Vercel | Build npm run build, output dist. |
| VPS + Nginx | try_files fallback to index.html. |
Notes
- History-mode routing needs a fallback or refreshes will 404.