Skip to content

Commit

Permalink
fix: use global when evaluating HMR update (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
zamotany authored May 25, 2021
1 parent d8fdff5 commit 525b696
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/runtime/setupChunkLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ async function loadHmrUpdate(url: string, cb: LoadCallback) {
try {
// @ts-ignore
const globalEvalWithSourceUrl = global.globalEvalWithSourceUrl;
if (globalEvalWithSourceUrl) {
globalEvalWithSourceUrl(script, null);
} else {
eval(script);
}
(function () {
if (globalEvalWithSourceUrl) {
globalEvalWithSourceUrl(script, null);
} else {
eval(script);
}
}.call(global));
cb();
} catch (error) {
console.error('Loading HMR update chunk failed:', error);
Expand Down

0 comments on commit 525b696

Please sign in to comment.