webpack-dev-server 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Server.js +5 -5
- package/package.json +1 -1
package/lib/Server.js
CHANGED
|
@@ -36,13 +36,13 @@ class Server {
|
|
|
36
36
|
this.webSocketProxies = [];
|
|
37
37
|
this.sockets = [];
|
|
38
38
|
this.compiler = compiler;
|
|
39
|
+
this.currentHash = null;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
static get DEFAULT_STATS() {
|
|
42
43
|
return {
|
|
43
44
|
all: false,
|
|
44
45
|
hash: true,
|
|
45
|
-
assets: true,
|
|
46
46
|
warnings: true,
|
|
47
47
|
errors: true,
|
|
48
48
|
errorDetails: false,
|
|
@@ -1970,13 +1970,13 @@ class Server {
|
|
|
1970
1970
|
|
|
1971
1971
|
// eslint-disable-next-line class-methods-use-this
|
|
1972
1972
|
sendMessage(clients, type, data) {
|
|
1973
|
-
|
|
1973
|
+
for (const client of clients) {
|
|
1974
1974
|
// `sockjs` uses `1` to indicate client is ready to accept data
|
|
1975
1975
|
// `ws` uses `WebSocket.OPEN`, but it is mean `1` too
|
|
1976
1976
|
if (client.readyState === 1) {
|
|
1977
1977
|
client.send(JSON.stringify({ type, data }));
|
|
1978
1978
|
}
|
|
1979
|
-
}
|
|
1979
|
+
}
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
1982
|
serveMagicHtml(req, res, next) {
|
|
@@ -2011,8 +2011,7 @@ class Server {
|
|
|
2011
2011
|
stats &&
|
|
2012
2012
|
(!stats.errors || stats.errors.length === 0) &&
|
|
2013
2013
|
(!stats.warnings || stats.warnings.length === 0) &&
|
|
2014
|
-
stats.
|
|
2015
|
-
stats.assets.every((asset) => !asset.emitted);
|
|
2014
|
+
this.currentHash === stats.hash;
|
|
2016
2015
|
|
|
2017
2016
|
if (shouldEmit) {
|
|
2018
2017
|
this.sendMessage(clients, "still-ok");
|
|
@@ -2020,6 +2019,7 @@ class Server {
|
|
|
2020
2019
|
return;
|
|
2021
2020
|
}
|
|
2022
2021
|
|
|
2022
|
+
this.currentHash = stats.hash;
|
|
2023
2023
|
this.sendMessage(clients, "hash", stats.hash);
|
|
2024
2024
|
|
|
2025
2025
|
if (stats.errors.length > 0 || stats.warnings.length > 0) {
|