Dev Server Issues
Canβt Connect to Dev Server
Error:Unable to connect to dev server http://localhost:5173
Solutions:
-
Check dev server is running:
-
Check port matches:
-
Check firewall:
HMR Not Working
Problem: Changes donβt appear in browser Solutions:-
Configure HMR port:
-
Check WebSocket connection:
- Open browser DevTools β Network β WS
- Should see WebSocket connection to
ws://localhost:3000
-
Clear browser cache:
- Hard refresh:
Cmd/Ctrl + Shift + R
- Hard refresh:
Port Already in Use
Error:Port 3000 is already in use
Solutions:
-
Kill process:
-
Change port:
Build Issues
Build Fails
Error:Build failed with errors
Solutions:
-
Clear cache:
-
Clear Vite cache:
-
Check Node version:
Assets Not Found After Build
Problem: 404 errors for assets in production Solutions:-
Check embed path:
-
Check Vite base:
-
Rebuild:
Routing Issues
404 on Page Refresh
Problem: Direct navigation works, refresh gives 404 Solution: This is expected for SPAs. Mizu servesindex.html for all routes (SPA fallback).
If itβs not working:
API Routes Return HTML
Problem:/api/users returns HTML instead of JSON
Solutions:
-
Define API routes before frontend middleware:
-
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:
-
Dev server is proxying correctly:
-
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:
-
Check import path:
-
Configure path aliases:
Performance Issues
Slow Initial Load
Solutions:-
Enable code splitting:
-
Analyze bundle:
-
Reduce dependencies:
Slow HMR
Solutions:-
Optimize Vite config:
-
Reduce file watchers:
- Close unused files in editor
- Exclude
node_modulesfrom watchers
Environment Issues
Environment Variables Not Working
Problem:import.meta.env.VITE_API_URL is undefined
Solutions:
-
Check prefix:
- Restart dev server: Environment variables are loaded at startup
-
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:- Check GitHub Issues
- Ask in Discord
- Review examples