hackfix webpack dev server freezing

This commit is contained in:
Samuel Newman
2026-02-12 15:38:31 +02:00
parent 6d68a5bd21
commit 826965354a
+9
View File
@@ -35,6 +35,15 @@ module.exports = async function (env, argv) {
]
if (env.mode === 'development') {
config.plugins.push(new ReactRefreshWebpackPlugin())
// Reap zombie HMR WebSocket connections that linger after refresh.
// Without this, dead sockets exhaust the browser's per-origin connection
// pool and the dev server stops responding.
config.devServer.onListening = devServer => {
devServer.server.on('connection', socket => {
socket.setTimeout(10000)
socket.on('timeout', () => socket.destroy())
})
}
} else {
// Support static CDN for chunks
config.output.publicPath = 'auto'