Skip to content

Commit ccc8163

Browse files
hccdeSpaceK33z
authored andcommitted
Fix exception when client script is used in webworkers (#813)
1 parent f996bd4 commit ccc8163

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function log(level, msg) {
4747

4848
// Send messages to the outside, so plugins can consume it.
4949
function sendMsg(type, data) {
50-
if(typeof self !== "undefined") {
50+
if(typeof self !== "undefined" && self.window) {
5151
self.postMessage({
5252
type: "webpack" + type,
5353
data: data
@@ -162,7 +162,7 @@ function reloadApp() {
162162
log("info", "[WDS] App hot update...");
163163
var hotEmitter = require("webpack/hot/emitter");
164164
hotEmitter.emit("webpackHotUpdate", currentHash);
165-
if(typeof self !== "undefined") {
165+
if(typeof self !== "undefined" && self.window) {
166166
// broadcast update to window
167167
self.postMessage("webpackHotUpdate" + currentHash, "*");
168168
}

0 commit comments

Comments
 (0)