Add an unobtrusive log when server disconnects

This commit is contained in:
Dan Abramov
2016-09-25 12:38:31 +01:00
parent e872907b50
commit 17ab11e279

View File

@@ -130,9 +130,15 @@ var connection = new SockJS(url.format({
// Hardcoded in WebpackDevServer
pathname: '/sockjs-node'
}));
// Note: unlike WebpackDevServer's built-in client,
// we don't handle disconnect. If connection fails,
// just leave it instead of spamming the console.
// Unlike WebpackDevServer client, we won't try to reconnect
// to avoid spamming the console. Disconnect usually happens
// when developer stops the server.
connection.onclose = function() {
console.info(
'The development server has disconnected.\nRefresh the page if necessary.'
);
};
// Remember some state related to hot module replacement.
var isFirstCompilation = true;