Lovable app shows a blank white page after deploy: causes and fixes
By AI App Medic · Updated · Lovable · Deploy · Vite
The deploy says "Ready", the URL loads, and you get an empty white page. With a Vite + React app (which classic Lovable, Bolt and many Cursor projects are) this almost always means the HTML loaded but the JavaScript either failed to load or crashed before React could render. The browser console tells you which.
Step 1: open the console
Open the live URL, press F12, and look at Console and Network. Match what you see:
| What you see | Likely cause |
|---|---|
supabaseUrl is required or undefined config values | Environment variables missing at build time |
| JS files return 404, or "MIME type text/html" for a script | Wrong output folder, wrong base, or a rewrite that catches asset requests |
| "Failed to load module script ... application/octet-stream" | You deployed the source folder instead of the built dist |
| Home page works, other URLs 404 on refresh | Missing SPA rewrite |
| A different red error from your own code | A runtime bug that only appears in production (for example code relying on preview-only data) |
Cause 1: missing VITE_ environment variables
This is the most common one. Your project's .env (in Lovable or the synced GitHub repo) contains values like VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY or VITE_SUPABASE_ANON_KEY. The new host does not have them, so the Supabase client throws on startup.
- Copy the exact variable names from your project, including the
VITE_prefix. A Next.js-styleNEXT_PUBLIC_name will not work in a Vite app. - Add them in the host: Vercel > Project > Settings > Environment Variables (enable for Production), or Netlify > Site configuration > Environment variables.
- Redeploy. Vite writes the values into the bundle during the build, so changing variables does nothing to an existing deployment.
Only put public values here. Secret keys must never have the VITE_ prefix. See why VITE_ variables are public.
Cause 2: wrong build command or output folder
For a Vite app the build command is npm run build and the publish/output directory is dist. Pointing the host at the project root or at build (a Create React App convention) serves an empty or wrong page. If you uploaded files by hand, build locally first and upload only the contents of dist.
Cause 3: assets loading from the wrong path
If the app is served from a sub-folder (for example example.com/app/) you need base: '/app/' in vite.config. If it is served from the domain root, keep the default '/'. Also make sure your SPA rewrite does not rewrite /assets/*.js requests to index.html. Netlify's _redirects rule and nginx try_files both serve existing files first, so this usually comes from a hand-written catch-all.
Cause 4: deep links 404
If the home page renders but /dashboard fails after a refresh, add the SPA fallback for your host. Copy-paste configs for Netlify, Vercel, nginx, Apache and Cloudflare are in this guide.
Cause 5: a newer full-stack template
Some newer AI-builder templates are full-stack frameworks with a server part rather than a pure static Vite SPA. Check package.json: if the project uses a server framework, it must be deployed to a host that runs that server, and a static SPA rewrite is the wrong fix.
After the fix
Hard-refresh the live site, open a deep link in a private window, and test sign-in, since auth often breaks next. If login redirects to localhost, see this fix. If the console shows missing environment values after a Vercel or Netlify deploy, see Vercel build failures and Netlify env variables. If the app was already working and a later deploy produces Failed to fetch dynamically imported module in an open tab, see how to handle a missing Vite chunk.
FAQ
Why does my app work in Lovable but not on Vercel or Netlify?
Lovable's preview has your environment variables and build settings. A new host needs the same VITE_ variables set before the build, the right build command and output folder, and an SPA rewrite.
I added the environment variables but it is still blank. Why?
Vite bakes VITE_ values into the JavaScript at build time. You must trigger a new build and deploy after adding or changing them.
What is the correct output directory for a Lovable app?
For the classic Vite + React template it is dist, with build command npm run build. Newer full-stack templates may need a host that runs a server; check your package.json.
Related guides
- Bolt.new works in preview but breaks on Netlify: missing environment variables
- Cursor app Vercel build failed: fix the error that npm run dev never showed
- TypeError: Failed to fetch dynamically imported module, after a Vite deploy
- Vercel "No Output Directory named dist found after the Build completed": the build worked, the deploy failed
- Supabase "TypeError: Failed to fetch": why login and queries fail before Supabase answers