-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathreactRefreshEntry.js
More file actions
49 lines (42 loc) · 1.65 KB
/
reactRefreshEntry.js
File metadata and controls
49 lines (42 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { injectIntoGlobalHook } from 'react-refresh/runtime';
const safeThis = (() => {
// copied from core-js-pure/features/global-this
'use strict';
const check = (it) => it && it.Math === Math && it;
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
// eslint-disable-next-line es/no-global-this -- safe
return (
check(typeof globalThis === 'object' && globalThis) ||
check(typeof window === 'object' && window) ||
// eslint-disable-next-line no-restricted-globals -- safe
check(typeof self === 'object' && self) ||
check(typeof __webpack_require__.g === 'object' && __webpack_require__.g) ||
// eslint-disable-next-line no-new-func -- fallback
(function () {
return this;
})() ||
this ||
Function('return this')()
);
})();
if (process.env.NODE_ENV !== 'production') {
if (typeof safeThis !== 'undefined') {
let $RefreshInjected$ = '__reactRefreshInjected';
// Namespace the injected flag (if necessary) for monorepo compatibility
if (
typeof __react_refresh_library__ !== 'undefined' &&
__react_refresh_library__
) {
$RefreshInjected$ += `_${__react_refresh_library__}`;
}
// Only inject the runtime if it hasn't been injected
if (!safeThis[$RefreshInjected$]) {
injectIntoGlobalHook(safeThis);
// Empty implementation to avoid "ReferenceError: variable is not defined" in module which didn't pass builtin:react-refresh-loader
safeThis.$RefreshSig$ = () => (type) => type;
safeThis.$RefreshReg$ = () => {};
// Mark the runtime as injected to prevent double-injection
safeThis[$RefreshInjected$] = true;
}
}
}