Skip to content

Commit 82009f5

Browse files
authored
Bump webpack-dev-server (#7988)
1 parent 5d24a5e commit 82009f5

File tree

8 files changed

+181
-170
lines changed

8 files changed

+181
-170
lines changed

packages/create-react-app/yarn.lock.cached

+146-150
Large diffs are not rendered by default.

packages/react-dev-utils/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"react-error-overlay": "^6.0.3",
7373
"recursive-readdir": "2.2.2",
7474
"shell-quote": "1.7.2",
75-
"sockjs-client": "1.4.0",
7675
"strip-ansi": "5.2.0",
7776
"text-table": "0.2.0"
7877
},

packages/react-dev-utils/webpackHotDevClient.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// that looks similar to our console output. The error overlay is inspired by:
1717
// https://github.com/glenjamin/webpack-hot-middleware
1818

19-
var SockJS = require('sockjs-client');
2019
var stripAnsi = require('strip-ansi');
2120
var url = require('url');
2221
var launchEditorEndpoint = require('./launchEditorEndpoint');
@@ -58,9 +57,9 @@ if (module.hot && typeof module.hot.dispose === 'function') {
5857
}
5958

6059
// Connect to WebpackDevServer via a socket.
61-
var connection = new SockJS(
60+
var connection = new WebSocket(
6261
url.format({
63-
protocol: window.location.protocol,
62+
protocol: 'ws',
6463
hostname: window.location.hostname,
6564
port: window.location.port,
6665
// Hardcoded in WebpackDevServer

packages/react-scripts/config/webpackDevServer.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ module.exports = function(proxy, allowedHost) {
6666
// in the Webpack development configuration. Note that only changes
6767
// to CSS are currently hot reloaded. JS changes will refresh the browser.
6868
hot: true,
69+
// Use 'ws' instead of 'sockjs-node' on server since we're using native
70+
// websockets in `webpackHotDevClient`.
71+
transportMode: 'ws',
72+
// Prevent a WS client from getting injected as we're already including
73+
// `webpackHotDevClient`.
74+
injectClient: false,
6975
// It is important to tell WebpackDevServer to use the same "root" path
7076
// as we specified in the config. In development, we always serve from /.
7177
publicPath: '/',

packages/react-scripts/fixtures/kitchensink/template/integration/initDOM.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,36 @@ export default feature =>
4747
let window;
4848

4949
if (process.env.E2E_FILE) {
50-
window = (await JSDOM.fromFile(file, {
51-
pretendToBeVisual: true,
52-
resources: fileResourceLoader,
53-
runScripts: 'dangerously',
54-
url,
55-
})).window;
50+
window = (
51+
await JSDOM.fromFile(file, {
52+
pretendToBeVisual: true,
53+
resources: fileResourceLoader,
54+
runScripts: 'dangerously',
55+
url,
56+
})
57+
).window;
5658
} else {
57-
window = (await JSDOM.fromURL(url, {
58-
pretendToBeVisual: true,
59-
resources: 'usable',
60-
runScripts: 'dangerously',
61-
})).window;
59+
window = (
60+
await JSDOM.fromURL(url, {
61+
pretendToBeVisual: true,
62+
resources: 'usable',
63+
runScripts: 'dangerously',
64+
})
65+
).window;
6266
}
6367

68+
const cleanup = () => {
69+
if (window) {
70+
window.close();
71+
window = null;
72+
}
73+
};
74+
6475
const { document } = window;
6576

6677
const cancelToken = setTimeout(() => {
6778
// Cleanup jsdom instance since we don't need it anymore
68-
window.close();
79+
cleanup();
6980

7081
reject(`Timed out loading feature: ${feature}`);
7182
}, 10000);
@@ -81,7 +92,7 @@ export default feature =>
8192
clearTimeout(cancelToken);
8293

8394
// Cleanup jsdom instance since we don't need it anymore
84-
window.close();
95+
cleanup();
8596

8697
reject(`Error loading feature: ${feature}`);
8798
},

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"ts-pnp": "1.1.5",
7878
"url-loader": "2.2.0",
7979
"webpack": "4.41.2",
80-
"webpack-dev-server": "3.2.1",
80+
"webpack-dev-server": "3.9.0",
8181
"webpack-manifest-plugin": "2.2.0",
8282
"workbox-webpack-plugin": "4.3.1"
8383
},

tasks/e2e-kitchensink-eject.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ set -x
6565
cd ..
6666
root_path=$PWD
6767
# Set a Windows path for GitBash on Windows
68-
if [ $AGENT_OS == 'Windows_NT' ]; then
68+
if [ "$AGENT_OS" == 'Windows_NT' ]; then
6969
root_path=$(cmd //c cd)
7070
fi
7171

tasks/e2e-kitchensink.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ set -x
6565
cd ..
6666
root_path=$PWD
6767
# Set a Windows path for GitBash on Windows
68-
if [ $AGENT_OS == 'Windows_NT' ]; then
68+
if [ "$AGENT_OS" == 'Windows_NT' ]; then
6969
root_path=$(cmd //c cd)
7070
fi
7171

0 commit comments

Comments
 (0)