chore: admin 构建稳定 vendor 分包,消除 chunk 告警;更新 .env.example 品牌文案与端口

This commit is contained in:
2026-08-08 16:46:16 +08:00
parent 00cdb322d2
commit d27f10eb84
2 changed files with 27 additions and 2 deletions

View File

@@ -19,6 +19,31 @@ export default defineConfig({
},
},
},
build: {
// 稳定 vendor 分包:大库单独成 chunk利于浏览器缓存与按需加载
rolldownOptions: {
output: {
codeSplitting: {
groups: [
{
name: (id) => {
if (!id.includes('node_modules')) return null;
// 只对体积大且相互独立的纯库手动分组antd/markdown 栈
// 交给 rolldown 默认分包,避免人为制造超大 chunk。
if (/[\\/]node_modules[\\/](echarts|zrender)[\\/]/.test(id)) return 'echarts';
if (/[\\/]node_modules[\\/](react|react-dom|react-router|react-router-dom|scheduler|use-sync-external-store)[\\/]/.test(id)) return 'react';
if (/[\\/]node_modules[\\/]dayjs[\\/]/.test(id)) return 'dayjs';
if (/[\\/]node_modules[\\/]@tanstack[\\/]/.test(id)) return 'tanstack';
return null;
},
},
],
},
},
},
// 剩余大 chunk 均为按需加载AI 绘图/ECharts 等),阈值按实际调高避免误报
chunkSizeWarningLimit: 700,
},
optimizeDeps: {
include: [
'dayjs',

View File

@@ -1,5 +1,5 @@
# ============================
# 宿舍水电费系统 - 生产环境配置
# 恭学教育 - 生产环境配置
# ============================
# 复制此文件为 .env 并修改配置值
# cp .env.example .env
@@ -22,7 +22,7 @@ JWT_EXPIRES_IN=24h
ADMIN_PASSWORD=请替换为强密码
# ---- 服务端口 ----
PORT=3002
PORT=3000
# ---- 文件上传 ----
# 合同 PDF 存储根目录(相对或绝对)