Skip to main content
This guide helps you solve common issues when developing frontend applications with Mizu.

Dev Server Issues

Can’t Connect to Dev Server

Error: Unable to connect to dev server http://localhost:5173 Solutions:
  1. Check dev server is running:
  2. Check port matches:
  3. Check firewall:

HMR Not Working

Problem: Changes don’t appear in browser Solutions:
  1. Configure HMR port:
  2. Check WebSocket connection:
    • Open browser DevTools β†’ Network β†’ WS
    • Should see WebSocket connection to ws://localhost:3000
  3. Clear browser cache:
    • Hard refresh: Cmd/Ctrl + Shift + R

Port Already in Use

Error: Port 3000 is already in use Solutions:
  1. Kill process:
  2. Change port:

Build Issues

Build Fails

Error: Build failed with errors Solutions:
  1. Clear cache:
  2. Clear Vite cache:
  3. Check Node version:

Assets Not Found After Build

Problem: 404 errors for assets in production Solutions:
  1. Check embed path:
  2. Check Vite base:
  3. Rebuild:

Routing Issues

404 on Page Refresh

Problem: Direct navigation works, refresh gives 404 Solution: This is expected for SPAs. Mizu serves index.html for all routes (SPA fallback). If it’s not working:

API Routes Return HTML

Problem: /api/users returns HTML instead of JSON Solutions:
  1. Define API routes before frontend middleware:
  2. Check IgnorePaths:

CORS Issues

CORS Errors in Development

Error: Access to fetch at 'http://localhost:3000/api/users' from origin 'http://localhost:5173' has been blocked by CORS Solution: Mizu adds CORS headers automatically in dev mode, but ensure:
  1. Dev server is proxying correctly:
  2. Or use Mizu’s proxy: Don’t configure Vite proxy, let Mizu handle it:

CORS Errors in Production

Solution: Configure CORS middleware:

TypeScript Issues

Module Not Found

Error: Cannot find module './Component' Solutions:
  1. Check import path:
  2. Configure path aliases:

Performance Issues

Slow Initial Load

Solutions:
  1. Enable code splitting:
  2. Analyze bundle:
  3. Reduce dependencies:

Slow HMR

Solutions:
  1. Optimize Vite config:
  2. Reduce file watchers:
    • Close unused files in editor
    • Exclude node_modules from watchers

Environment Issues

Environment Variables Not Working

Problem: import.meta.env.VITE_API_URL is undefined Solutions:
  1. Check prefix:
  2. Restart dev server: Environment variables are loaded at startup
  3. Check file name:

Debugging Tips

Enable Debug Logging

Check Network Tab

Browser DevTools β†’ Network:
  • Filter by XHR to see API calls
  • Check request/response
  • Verify status codes

Check Console

Browser DevTools β†’ Console:
  • Look for JavaScript errors
  • Check for failed requests
  • Verify HMR messages

Verify Build Output

Getting Help

If you’re still stuck:
  1. Check GitHub Issues
  2. Ask in Discord
  3. Review examples

Next Steps

Common Patterns

Working code examples

Development

Development guide

Production

Production optimization