From 6e70e4d99835d20995f17ff82f7469988c47bec1 Mon Sep 17 00:00:00 2001 From: sjsjsj1246 Date: Sun, 5 Nov 2023 00:44:36 +0900 Subject: [PATCH] =?UTF-8?q?Hotfix:=20initializeApp=20=EC=9E=AC=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/initializeApp.ts | 42 ++++++++++++++++++++++-------------------- src/main.tsx | 5 +++-- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/initializeApp.ts b/src/initializeApp.ts index c21890d8..e997b21c 100644 --- a/src/initializeApp.ts +++ b/src/initializeApp.ts @@ -3,28 +3,30 @@ import { createBrowserHistory } from 'history'; import { enableMapSet } from 'immer'; import airbridge from 'airbridge-web-sdk-loader'; -enableMapSet(); +export default function initializeApp() { + enableMapSet(); -if (import.meta.env.PROD) { - // GA 관련 초기화 - ReactGA.initialize(import.meta.env.VITE_GA_TRACKING_ID, { gaOptions: {} }); + if (import.meta.env.PROD) { + // GA 관련 초기화 + ReactGA.initialize(import.meta.env.VITE_GA_TRACKING_ID, { gaOptions: {} }); - const history = createBrowserHistory(); - history.listen(async (response) => { - ReactGA.send({ hitType: 'pageview', page: response.location.pathname }); - }); - - // Pixel 관련 초기화 - import('react-facebook-pixel') - .then((module) => module.default) - .then((ReactPixel) => { - ReactPixel.init(import.meta.env.VITE_PIXEL_ID); - ReactPixel.pageView(); + const history = createBrowserHistory(); + history.listen(async (response) => { + ReactGA.send({ hitType: 'pageview', page: response.location.pathname }); }); - // Airbridge 관련 초기화 - airbridge.init({ - app: import.meta.env.VITE_AIRBRIDGE_NAME, - webToken: import.meta.env.VITE_AIRBRIDGE_WEB_TOKEN, - }); + // Pixel 관련 초기화 + import('react-facebook-pixel') + .then((module) => module.default) + .then((ReactPixel) => { + ReactPixel.init(import.meta.env.VITE_PIXEL_ID); + ReactPixel.pageView(); + }); + + // Airbridge 관련 초기화 + airbridge.init({ + app: import.meta.env.VITE_AIRBRIDGE_NAME, + webToken: import.meta.env.VITE_AIRBRIDGE_WEB_TOKEN, + }); + } } diff --git a/src/main.tsx b/src/main.tsx index 75fa9aef..d0d22ca5 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,10 @@ import { createRoot } from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { Toaster } from 'react-hot-toast'; import App from 'App'; import './index.css'; +import initializeApp from './initializeApp'; const queryClient = new QueryClient({ defaultOptions: { @@ -14,10 +14,11 @@ const queryClient = new QueryClient({ }, }); +initializeApp(); + const container = document.getElementById('root') as HTMLElement; const element = ( -