feat: 项目初始化

This commit is contained in:
JiaJun
2026-04-23 16:41:39 +08:00
parent be4669a9f1
commit bd92f10b83
42 changed files with 6047 additions and 2 deletions

31
src/main.tsx Normal file
View File

@@ -0,0 +1,31 @@
import { QueryClientProvider } from '@tanstack/react-query'
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
import { RouterProvider } from '@tanstack/react-router'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { APP_ROOT_ELEMENT_ID } from '@/constants'
import '@/i18n'
import { initializeAuthSession } from '@/lib/auth/auth-session'
import { queryClient } from '@/lib/query/query-client'
import { router } from '@/router'
import './styles.css'
const rootElement = document.getElementById(APP_ROOT_ELEMENT_ID)
const shouldShowQueryDevtools =
import.meta.env.VITE_APP_ENV === 'development' &&
import.meta.env.VITE_ENABLE_QUERY_DEVTOOLS === 'true'
if (!rootElement) {
throw new Error('Root element not found')
}
void initializeAuthSession()
createRoot(rootElement).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
{shouldShowQueryDevtools && <ReactQueryDevtools initialIsOpen={false} />}
</QueryClientProvider>
</StrictMode>,
)