webpack-dev-server 2.4.1 → 2.4.2
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/README.md +0 -2
- package/bin/webpack-dev-server.js +12 -1
- package/client/index.bundle.js +1 -3
- package/client/index.js +10 -2
- package/client/live.bundle.js +3 -6
- package/client/sockjs.bundle.js +1 -2
- package/lib/Server.js +62 -52
- package/lib/util/addDevServerEntrypoints.js +4 -2
- package/package.json +5 -3
package/client/index.js
CHANGED
|
@@ -47,7 +47,7 @@ function log(level, msg) {
|
|
|
47
47
|
|
|
48
48
|
// Send messages to the outside, so plugins can consume it.
|
|
49
49
|
function sendMsg(type, data) {
|
|
50
|
-
if(typeof self !== "undefined") {
|
|
50
|
+
if(typeof self !== "undefined" && self.window) {
|
|
51
51
|
self.postMessage({
|
|
52
52
|
type: "webpack" + type,
|
|
53
53
|
data: data
|
|
@@ -157,12 +157,20 @@ var socketUrl = url.format({
|
|
|
157
157
|
|
|
158
158
|
socket(socketUrl, onSocketMsg);
|
|
159
159
|
|
|
160
|
+
var isUnloading = false;
|
|
161
|
+
self.addEventListener("beforeunload", function() {
|
|
162
|
+
isUnloading = true;
|
|
163
|
+
});
|
|
164
|
+
|
|
160
165
|
function reloadApp() {
|
|
166
|
+
if(isUnloading) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
161
169
|
if(hot) {
|
|
162
170
|
log("info", "[WDS] App hot update...");
|
|
163
171
|
var hotEmitter = require("webpack/hot/emitter");
|
|
164
172
|
hotEmitter.emit("webpackHotUpdate", currentHash);
|
|
165
|
-
if(typeof self !== "undefined") {
|
|
173
|
+
if(typeof self !== "undefined" && self.window) {
|
|
166
174
|
// broadcast update to window
|
|
167
175
|
self.postMessage("webpackHotUpdate" + currentHash, "*");
|
|
168
176
|
}
|