From 2333711a0ff36e302a7afa37f4ee049ed6abfb55 Mon Sep 17 00:00:00 2001 From: ReaJason Date: Thu, 14 Aug 2025 18:52:31 +0800 Subject: [PATCH] fix(web): reactRouter basename not work --- web/src/router.tsx | 6 +----- web/vite.config.ts | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/web/src/router.tsx b/web/src/router.tsx index c7f19fae..e5166b14 100644 --- a/web/src/router.tsx +++ b/web/src/router.tsx @@ -1,6 +1,5 @@ import { createHashRouter } from "react-router-dom"; import RootLayout from "@/components/layouts/root-layout"; -import { env } from "@/config"; import MemShellPage from "@/pages/memshell"; import ProbeShellPage from "@/pages/probeshell"; import type { MemShellFormSchema } from "@/types/schema"; @@ -96,8 +95,5 @@ export const router = createHashRouter( }, ], }, - ], - { - basename: env.BASE_PATH, - }, + ] ); diff --git a/web/vite.config.ts b/web/vite.config.ts index f4ba1835..965b0988 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -2,9 +2,11 @@ import path from "node:path"; import tailwindcss from "@tailwindcss/vite"; import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; +import { env } from "node:process"; // https://vitejs.dev/config/ export default defineConfig({ + base: env.VITE_APP_BASE_PATH, plugins: [react(), tailwindcss()], resolve: { alias: {