Fix webpack dev server freezing after repeated refreshes (#9865)
This commit is contained in:
@@ -36,6 +36,15 @@ module.exports = async function (env, argv) {
|
|||||||
]
|
]
|
||||||
if (env.mode === 'development') {
|
if (env.mode === 'development') {
|
||||||
config.plugins.push(new ReactRefreshWebpackPlugin())
|
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 {
|
} else {
|
||||||
// Support static CDN for chunks
|
// Support static CDN for chunks
|
||||||
config.output.publicPath = 'auto'
|
config.output.publicPath = 'auto'
|
||||||
|
|||||||
Reference in New Issue
Block a user