Skip to content

Commit 85d906e

Browse files
committed
Strongly check client isn't running on WebWorker for sendMsg
1 parent ab889c3 commit 85d906e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

client/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ 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" && self.window) {
50+
if(
51+
typeof self !== "undefined" &&
52+
(typeof WorkerGlobalScope === "undefined" ||
53+
!(self instanceof self.WorkerGlobalScope))
54+
) {
5155
self.postMessage({
5256
type: "webpack" + type,
5357
data: data

0 commit comments

Comments
 (0)