Lovable
deployment
Vite Hot Module Replacement (HMR) Connection Fails
Vite dev server starts but HMR connection fails with 'WebSocket connection failed' or 'net::ERR_CONNECTION_REFUSED'. Changes require manual page refresh instead of hot reload. Development experience is slow.
HMR requires WebSocket connection from browser to dev server. Network configuration or firewall can block the connection.
Error Messages You Might See
WebSocket connection failed
net::ERR_CONNECTION_REFUSED
HMR connection timed out
Common Causes
- Dev server not on correct host/port
- WebSocket connection blocked by firewall/proxy
- HMR host not configured for remote dev
- HTTPS in production with HTTP dev server mismatch
- Port not exposed in container/VM environment
How to Fix It
Configure HMR in vite.config.js for remote dev:
export default {
server: {
hmr: {
host: 'localhost',
port: 5173,
protocol: 'ws'
}
}
}For remote development (Docker, VM):
hmr: {
host: 'your-dev-server.com',
port: 443,
protocol: 'wss'
}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