Skip to content

Commit b0aee12

Browse files
authored
only set globals if they are undefined (#17)
1 parent 02f5bf2 commit b0aee12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/loader.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ async function load(source) {
7575
let previousDocument = global.document;
7676
let previousElement = global.Element;
7777
// https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/176#issuecomment-683150213
78-
global.$RefreshReg$ = noop;
79-
global.$RefreshSig$ = () => noop;
78+
global.$RefreshReg$ = previousRefreshReg || noop;
79+
global.$RefreshSig$ = previousRefreshSig || (() => noop);
8080
global.document = previousDocument || {
8181
querySelector: noop,
8282
querySelectorAll: noop,
8383
};
84-
global.Element = class Element {};
84+
global.Element = previousElement || class Element {};
8585

8686
// This imports the config as an in-memory object
8787
const importAtBuildTime = async (resource) => {

0 commit comments

Comments
 (0)