-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.tsx
More file actions
71 lines (61 loc) · 2.14 KB
/
main.tsx
File metadata and controls
71 lines (61 loc) · 2.14 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// import { StrictMode } from 'react';
import { QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { OverlayProvider } from 'overlay-kit';
import { createRoot } from 'react-dom/client';
import { ErrorBoundary } from 'react-error-boundary';
import { HelmetProvider } from 'react-helmet-async';
import { ToastContainer } from 'react-toastify';
import { initClarity } from '@shared/config/clarity';
import {
getSentryReactErrorHandlerOptions,
initSentry,
} from '@shared/config/sentry';
import { toastConfig } from '@shared/types/toast';
import { queryClient } from '@apis/config/queryClient';
import AppErrorFallback from '@components/errorFallback/AppErrorFallback';
import '@styles/global.css';
import App from './App';
// TODO: UI 테스트용 MSW 활성화 — API 배포 후 제거
async function enableMocking() {
if (!import.meta.env.DEV) return;
const { worker } = await import('./mocks/browser');
return worker.start({ onUnhandledRequest: 'bypass' });
}
initSentry();
initClarity();
// 개발 모드: 최초 진입 시 ?ab=single|multiple 을 로컬스토리지에 저장
if (import.meta.env.DEV) {
try {
const sp = new URLSearchParams(window.location.search);
const ab = sp.get('ab');
if (ab === 'single' || ab === 'multiple') {
localStorage.setItem('ab_image_variant', ab);
}
} catch {
console.error('Error setting ab_image_variant');
}
}
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error('Root element not found');
}
enableMocking().then(() => {
createRoot(rootElement, getSentryReactErrorHandlerOptions()).render(
// <StrictMode>
<ErrorBoundary FallbackComponent={AppErrorFallback}>
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<OverlayProvider>
<App />
<ToastContainer {...toastConfig} />
{import.meta.env.DEV && (
<ReactQueryDevtools initialIsOpen={false} />
)}
</OverlayProvider>
</QueryClientProvider>
</HelmetProvider>
</ErrorBoundary>
// </StrictMode>
);
});