UNPKG

862 BJavaScriptView Raw
1/* global __react_refresh_library__ */
2
3const safeThis = require('core-js-pure/features/global-this.js');
4const RefreshRuntime = require('react-refresh/runtime.js');
5
6if (process.env.NODE_ENV !== 'production') {
7 if (typeof safeThis !== 'undefined') {
8 var $RefreshInjected$ = '__reactRefreshInjected';
9 // Namespace the injected flag (if necessary) for monorepo compatibility
10 if (typeof __react_refresh_library__ !== 'undefined' && __react_refresh_library__) {
11 $RefreshInjected$ += '_' + __react_refresh_library__;
12 }
13
14 // Only inject the runtime if it hasn't been injected
15 if (!safeThis[$RefreshInjected$]) {
16 // Inject refresh runtime into global scope
17 RefreshRuntime.injectIntoGlobalHook(safeThis);
18
19 // Mark the runtime as injected to prevent double-injection
20 safeThis[$RefreshInjected$] = true;
21 }
22 }
23}