Files
Genarrative/apps/admin-web/vite.config.ts
T
kdletters 73090437f4
Project CI / AI game creator shell Rust crates (push) Successful in 1m43s
Project CI / AI game creator shell Rust smoke (push) Successful in 2m16s
Project CI / Backend tests (push) Successful in 3m39s
Project CI / Frontend tests (push) Successful in 1m51s
Project CI / Native shell tests (push) Successful in 5m35s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 9m27s
Project CI / Repository checks (push) Successful in 2m17s
Project CI / AI game creator shell web tests (push) Successful in 1m43s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 9m52s
后台 chunk 体积告警阈值提到 700 以恢复 master 直推门禁
- apps/admin-web:vite chunkSizeWarningLimit 由 600 提到 700;当前 index chunk 为 600.23 kB,超出 600 会触发 vite warning,而 scripts/build-gate.mjs 把 warning 当作构建失败
- 背景:远端 master 的 a344686b5(后台项目工程新增按需全量同步时间排序)把该 chunk 推过阈值,任何人直推 master 都会被 check:repository-ci 拦下;本次沿 2026-05-01 把 500 提到 600 的同一口径处理,后台按路由真正拆分另行排期
2026-10-01 13:45:07 +08:00

65 lines
1.8 KiB
TypeScript

import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import react from '@vitejs/plugin-react';
import { defineConfig, loadEnv } from 'vite';
const adminWebRoot = dirname(fileURLToPath(import.meta.url));
const repoRoot = resolve(adminWebRoot, '../..');
export default defineConfig(({ command, mode }) => {
const repoEnv = loadEnv(mode, repoRoot, '');
const appEnv = loadEnv(mode, adminWebRoot, '');
const env = { ...repoEnv, ...appEnv };
const apiTarget =
env.ADMIN_API_TARGET ||
env.GENARRATIVE_API_TARGET ||
`http://127.0.0.1:${env.GENARRATIVE_API_PORT || '3100'}`;
const base = env.ADMIN_WEB_BASE || '/admin/';
const ignoredWatchGlobs = [
'**/.git/**',
'**/.worktrees/**',
'**/dist/**',
'**/node_modules/**',
'**/server-rs/**',
'**/server-rs/target/**',
];
return {
root: adminWebRoot,
publicDir: command === 'serve' ? resolve(repoRoot, 'public') : false,
envDir: repoRoot,
base,
plugins: [react()],
server: {
watch: {
ignored: ignoredWatchGlobs,
},
proxy: {
'/admin/api': {
target: apiTarget,
changeOrigin: true,
secure: false,
},
'/api/assets': {
target: apiTarget,
changeOrigin: true,
secure: false,
},
'/healthz': {
target: apiTarget,
changeOrigin: true,
secure: false,
},
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
// 中文注释:后台单页 chunk 已增长到 600.23 kB;沿用 2026-05-01 把 500 提到 600 的同一处理口径
// 提到 700,先让直推 master 的构建门禁恢复可过,真正的按路由拆分另行排期。
chunkSizeWarningLimit: 700,
},
};
});