Your React + Vite app works perfectly on localhost. You deploy it, and you get a white screen, missing assets, or a 404 when you refresh a page.
Before you start changing random config files and redeploying over and over, go through these checks in order.
1. Open the browser console and network tab first
A blank page almost always has an error behind it. A red error in the Console, or a failed request in the Network tab (for example a 404 on a JS or CSS file), tells you which of the steps below to focus on.
2. Check your base setting
If your site is served from a subpath (like username.github.io/my-app/), assets will 404 unless base is set in vite.config.js:
export default defineConfig({ base: '/my-app/', }) If you deploy to a root domain, base should be '/'.
3. Fix the 404 when you refresh a route
React Router handles routes in the browser, but the server doesn't know them. So refreshing /about returns a 404. You need a fallback to index.html.
On Vercel, add a vercel.json:
{ "rewrites": [{ "source": "/(.*)", "destination": "/" }] } On Cloudflare Pages, add a public/_redirects file:
/* /index.html 200 4. Check your environment variables
Three common mistakes:
- Client-side variables in Vite must start with
VITE_, and you read them withimport.meta.env.VITE_YOUR_KEY, notprocess.env. - Variables must be set in your host's dashboard (Vercel, Cloudflare), not only in your local
.envfile. - They are baked in at build time, so after adding or changing one you need to redeploy.
5. Watch out for case-sensitive file names
Windows and macOS often ignore letter case, but Linux build servers don't. This works locally and fails in production if the file is actually named Header.jsx:
import Header from './header' 6. Confirm your build settings and project root
- Build command:
npm run build - Output directory:
dist - If your app lives in a subfolder (a monorepo, for example), set the correct root directory in your host settings.
Still stuck?
I put all of this into a free field guide. It includes a 10-minute deployment triage, a diagnostic decision tree, an incident worksheet and a pre-deployment checklist, with checks for Vercel and Cloudflare Pages.
👉 Get the free React Deployment Rescue Kit
If one of these fixed your blank page, let me know in the comments. And if it's something else, share your error message and I'll help you narrow it down.

