R: make react-scan import optional

This commit is contained in:
Ivan 2025-02-22 14:29:38 +03:00
parent 00a64e90f1
commit 1afc179d06

View File

@ -1,15 +1,16 @@
import { createRoot } from 'react-dom/client';
import { scan } from 'react-scan';
import { GlobalProviders } from './app/GlobalProviders';
import { App } from './app';
import './index.css';
if (typeof window !== 'undefined') {
scan({
enabled: !!process.env.NODE_ENV && process.env.NODE_ENV === 'development'
});
if (typeof window !== 'undefined' && !!process.env.NODE_ENV && process.env.NODE_ENV === 'development') {
void import('react-scan').then(module =>
module.scan({
enabled: true
})
);
}
createRoot(document.getElementById('root')!).render(