Skip to content

Commit 17ab11e

Browse files
committed
Add an unobtrusive log when server disconnects
1 parent e872907 commit 17ab11e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react-dev-utils/webpackHotDevClient.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,15 @@ var connection = new SockJS(url.format({
130130
// Hardcoded in WebpackDevServer
131131
pathname: '/sockjs-node'
132132
}));
133-
// Note: unlike WebpackDevServer's built-in client,
134-
// we don't handle disconnect. If connection fails,
135-
// just leave it instead of spamming the console.
133+
134+
// Unlike WebpackDevServer client, we won't try to reconnect
135+
// to avoid spamming the console. Disconnect usually happens
136+
// when developer stops the server.
137+
connection.onclose = function() {
138+
console.info(
139+
'The development server has disconnected.\nRefresh the page if necessary.'
140+
);
141+
};
136142

137143
// Remember some state related to hot module replacement.
138144
var isFirstCompilation = true;

0 commit comments

Comments
 (0)