Support configurable Vite base for admin path or subdomain deploys.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-07-24 17:29:30 +03:30
co-authored by Cursor
parent 722a520e68
commit 5088e0f4ae
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ import { ReportagePage } from "./pages/ReportagePage";
export default function App() { export default function App() {
return ( return (
<BrowserRouter> <BrowserRouter basename={import.meta.env.BASE_URL.replace(/\/$/, "")}>
<Routes> <Routes>
<Route path="/login" element={<LoginPage />} /> <Route path="/login" element={<LoginPage />} />
+3
View File
@@ -3,6 +3,9 @@ import react from "@vitejs/plugin-react";
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
// Production one-VM path deploy: VITE_BASE=/admin/
// Subdomain deploy can omit this (defaults to /).
base: process.env.VITE_BASE ?? "/",
server: { server: {
host: "127.0.0.1", host: "127.0.0.1",
port: 5173, port: 5173,