From 4c4215882e16992fdc054d364af2e3a0ef6f1a22 Mon Sep 17 00:00:00 2001 From: shu Date: Sun, 6 Sep 2026 19:41:09 +0800 Subject: 支持环境变量配置路由模式和资源路径并更新菜单图标 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增默认环境配置,通过 VITE_ROUTER_MODE 切换 Hash 与 History 路由,默认使用 Hash;通过 VITE_BASE_URL 配置资源基础路径,默认使用 /。 补充本地环境覆盖、构建方式及部署注意事项文档,保持 .env.local 不纳入版本控制。 桌面侧栏按钮改用 SidebarSimpleIcon,展开时填充、折叠时描边,保留无障碍状态描述。 验证:pnpm lint、pnpm build 和 git diff --check 通过。构建仍有现存的主包超过 500 kB 提示。 --- vite.config.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vite.config.ts') diff --git a/vite.config.ts b/vite.config.ts index 9982072..e7854a1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,12 @@ import react from '@vitejs/plugin-react' -import { defineConfig } from 'vite' +import { defineConfig, loadEnv } from 'vite' // https://vite.dev/config/ -export default defineConfig({ - plugins: [react()], +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd()) + + return { + base: env.VITE_BASE_URL || '/', + plugins: [react()], + } }) -- cgit v1.2.3