fix: relative base + runtime config for frontgen placement

This commit is contained in:
frontgen 2026-09-30 11:10:35 +00:00
parent e9478838d4
commit 48b8f05204
3 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,8 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!--BASE_HREF-->
<script src="./config.js"></script>
<title>Office Asset Management</title> <title>Office Asset Management</title>
</head> </head>
<body> <body>

View File

@ -8,7 +8,7 @@ import './styles/global.css'
ReactDOM.createRoot(document.getElementById("root")).render( ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode> <React.StrictMode>
<BrowserRouter basename={import.meta.env.BASE_URL}> <BrowserRouter basename={import.meta.env.DEV ? "/" : new URL(document.baseURI).pathname}>
<AuthProvider> <AuthProvider>
<AppProvider> <AppProvider>
<App /> <App />

View File

@ -2,8 +2,8 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
export default defineConfig(({ command }) => ({ export default defineConfig(({ command }) => ({
// The preview runs at https://preview-dev.getzino.in/asset-management/ // Relative base: frontgen places one artifact at any mount path and injects <base href>.
base: command === "build" ? "/asset-management/" : "/", base: "./",
plugins: [react()], plugins: [react()],
server: { server: {
port: 5173, port: 5173,