Lovable deployment

Vite Build Produces Blank Page in Production

App works perfectly in development (npm run dev) but production build shows blank page (npm run build). No errors in console. Static assets fail to load with 404. JavaScript doesn't execute.

Production builds use optimized bundling that can expose issues hidden in dev mode. Base path, asset references, and build configuration mismatches cause blank pages.

Error Messages You Might See

Failed to load module Uncaught SyntaxError: Unexpected token '<' 404 Not Found for .js file
Failed to load moduleUncaught SyntaxError: Unexpected token '<'404 Not Found for .js file

Common Causes

  1. vite.config.js base path not matching deployment path
  2. Assets deployed to wrong location relative to HTML
  3. JavaScript bundle not loaded due to MIME type or path issue
  4. build output directory not deployed correctly
  5. Subpath deployment without base configuration

How to Fix It

Check vite.config.js base path matches deployment:

export default {
  base: '/', // Use './' for relative paths or set full domain
  build: {
    outDir: 'dist',
    sourcemap: false
  }
}

Deploy entire dist/ folder. Verify assets load in DevTools Network tab with correct paths.

Real developers can help you.

Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it. Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Richard McSorley Richard McSorley Full-Stack Software Engineer with 8+ years building high-performance applications for enterprise clients. Shipped production systems at Walmart (4,000+ stores), Cigna (20M+ users), and Arkansas Blue Cross. 5 patents in retail/supply chain tech. Currently focused on AI integrations, automation tools, and TypeScript-first architectures. Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too AUXLE AUXLE I am a Full Stack Developer experienced in building Websites, Web apps and Cross Platform Mobile Apps for Startups and Companies. Bastien Labelle Bastien Labelle Full stack dev w/ 20+ years of experience Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why does dev work but production doesn't?

Dev uses unoptimized code. Production bundles and minifies. Check vite.config.js base path matches deployment location.

How do I deploy to a subpath?

Set base: '/subpath/' in vite.config.js. Deploy dist folder to that subpath on server.

Related Lovable Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help