Fix webpack dev server freezing after repeated refreshes (#9865)

This commit is contained in:
Samuel Newman
2026-02-18 19:03:23 +00:00
committed by GitHub
parent 775a041b71
commit c906fea77a
+9
View File
@@ -36,6 +36,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'