Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined') {
const Refresh = require('react-refresh/runtime');
// Inject refresh runtime into global
Refresh.injectIntoGlobalHook(window);
// Setup placeholder functions
window.$RefreshReg$ = function() {};
window.$RefreshSig$ = function() {
return function(type) {
return type;
};
};
/**
* Setup module refresh.
* @param {number} moduleId An ID of a module.
* @returns {function(): void} A function to restore handlers to their previous state.
*/
window.$RefreshSetup$ = function setupModuleRefresh(moduleId) {
// Capture previous refresh state
if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined') {
const Refresh = require('react-refresh/runtime');
Refresh.injectIntoGlobalHook(window);
(window as any).$RefreshReg$ = (): void => undefined;
(window as any).$RefreshSig$ = () => (type: T) => type;
}