diff --git a/src/App.tsx b/src/App.tsx index f2e61dd..a0a7739 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -40,7 +40,7 @@ const router = createBrowserRouter( }, ], { - basename: "/admin-dashboard/", + basename: import.meta.env.DEV ? "/" : "/admin-dashboard/", } ); function App() { diff --git a/vite.config.ts b/vite.config.ts index 9909069..7ee291b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,15 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react-swc' // https://vitejs.dev/config/ -export default defineConfig({ - base: "/admin-dashboard/", - plugins: [react()], +export default defineConfig(({ command }) => { + const config = { + plugins: [react()], + base: '/', + } + + if (command !== 'serve') { + config.base = '/admin-dashboard/' + } + + return config })