From 70fc056af1e212da0d5b816244b0561eb546d94d Mon Sep 17 00:00:00 2001 From: ybgbob Date: Wed, 28 Aug 2024 17:27:57 +0800 Subject: [PATCH] chore: dynamic router --- src/App.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ce7a115..cc0f6c8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ import { WagmiConfig } from 'wagmi'; import NiceModal from '@ebay/nice-modal-react'; import { ThemeProvider } from '@totejs/uikit'; -import { BrowserRouter, Route, Routes } from 'react-router-dom'; +import { BrowserRouter, HashRouter, Route, Routes } from 'react-router-dom'; import Layout from './components/layout/Index'; import { ModalProvider } from './context/modal'; import Home from './pages/Home'; @@ -80,6 +80,9 @@ const ReactQueryDevtoolsProduction = React.lazy(() => const queryClient = new QueryClient(); +const Router = + process.env.NODE_ENV === 'production' ? BrowserRouter : HashRouter; + function App() { const [showDevtools, setShowDevtools] = React.useState(false); @@ -96,7 +99,7 @@ function App() { - + {routes.map((item: IRoute) => { @@ -110,7 +113,7 @@ function App() { })} - +