diff options
| author | shu <nvcsadjkojf@outlook.com> | 2026-09-06 19:41:09 +0800 |
|---|---|---|
| committer | shu <nvcsadjkojf@outlook.com> | 2026-09-06 19:41:09 +0800 |
| commit | 4c4215882e16992fdc054d364af2e3a0ef6f1a22 (patch) | |
| tree | 69e3732feb999e786ce5c051ec98a060073d9842 /vite.config.ts | |
| parent | 61c1674e439dd791aee4fdc72e5738bbefed13e9 (diff) | |
新增默认环境配置,通过 VITE_ROUTER_MODE 切换 Hash 与 History 路由,默认使用 Hash;通过 VITE_BASE_URL 配置资源基础路径,默认使用 /。
补充本地环境覆盖、构建方式及部署注意事项文档,保持 .env.local 不纳入版本控制。
桌面侧栏按钮改用 SidebarSimpleIcon,展开时填充、折叠时描边,保留无障碍状态描述。
验证:pnpm lint、pnpm build 和 git diff --check 通过。构建仍有现存的主包超过 500 kB 提示。
Diffstat (limited to 'vite.config.ts')
| -rw-r--r-- | vite.config.ts | 11 |
1 files changed, 8 insertions, 3 deletions
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()], + } }) |
