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
Common Causes
- vite.config.js base path not matching deployment path
- Assets deployed to wrong location relative to HTML
- JavaScript bundle not loaded due to MIME type or path issue
- build output directory not deployed correctly
- 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.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get Help