webpack-dev-server 2.9.0 → 2.9.4
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 +111 -25
- package/bin/webpack-dev-server.js +9 -10
- package/client/index.bundle.js +1 -1
- package/client/index.js +19 -1
- package/client/live.bundle.js +3 -3
- package/client/socket.js +1 -1
- package/lib/Server.js +11 -6
- package/lib/optionsSchema.json +0 -3
- package/lib/polyfills.js +3 -4
- package/lib/util/createDomain.js +5 -1
- package/package.json +7 -3
package/client/index.js
CHANGED
|
@@ -218,7 +218,25 @@ function reloadApp() {
|
|
|
218
218
|
self.postMessage('webpackHotUpdate' + currentHash, '*');
|
|
219
219
|
}
|
|
220
220
|
} else {
|
|
221
|
+
let rootWindow = self;
|
|
222
|
+
// use parent window for reload (in case we're in an iframe with no valid src)
|
|
223
|
+
const intervalId = self.setInterval(function findRootWindow() {
|
|
224
|
+
if (rootWindow.location.protocol !== 'about:') {
|
|
225
|
+
// reload immediately if protocol is valid
|
|
226
|
+
applyReload(rootWindow, intervalId);
|
|
227
|
+
} else {
|
|
228
|
+
rootWindow = rootWindow.parent;
|
|
229
|
+
if (rootWindow.parent === rootWindow) {
|
|
230
|
+
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
|
231
|
+
applyReload(rootWindow, intervalId);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function applyReload(rootWindow, intervalId) {
|
|
238
|
+
clearInterval(intervalId);
|
|
221
239
|
log.info('[WDS] App updated. Reloading...');
|
|
222
|
-
|
|
240
|
+
rootWindow.location.reload();
|
|
223
241
|
}
|
|
224
242
|
}
|