Skip to content

Commit 00daab2

Browse files
committed
fixup! [fix] error on HMR with es6 bundles
1 parent 27e4d14 commit 00daab2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/webworker/WebWorkerMainTemplatePlugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class WebWorkerMainTemplatePlugin {
8282
});
8383

8484
return source + "\n" +
85-
`var parentHotUpdateCallback = window[${JSON.stringify(hotUpdateFunction)}];\n` +
86-
`window[${JSON.stringify(hotUpdateFunction)}] = ` +
85+
`var parentHotUpdateCallback = self[${JSON.stringify(hotUpdateFunction)}];\n` +
86+
`self[${JSON.stringify(hotUpdateFunction)}] = ` +
8787
Template.getFunctionContent(require("./WebWorkerMainTemplate.runtime.js"))
8888
.replace(/\/\/\$semicolon/g, ";")
8989
.replace(/\$require\$/g, this.requireFn)

test/WebWorkerMainTemplatePlugin.unittest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ installedChunks[chunkIds.pop()] = 1;
188188
it("returns the original source with hot update callback", () => {
189189
env.source.should.be.exactly(`
190190
moduleSource()
191-
var parentHotUpdateCallback = window["webpackHotUpdate"];
192-
window["webpackHotUpdate"] = function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
191+
var parentHotUpdateCallback = self["webpackHotUpdate"];
192+
self["webpackHotUpdate"] = function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
193193
hotAddUpdateChunk(chunkId, moreModules);
194194
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
195195
} ;

0 commit comments

Comments
 (0)