refactor(build): improve caching strategy with content hashing

feat(header): add translation support for menu items
fix(models): enhance model factory handling with proper dialogs
This commit is contained in:
2025-10-29 10:29:08 +08:00
parent 303715f82c
commit ef0a99ea30
9 changed files with 158 additions and 145 deletions

View File

@@ -17,14 +17,31 @@ export default defineConfig({
build: {
rollupOptions: {
output: {
// 优化缓存策略,使用内容哈希,启用长期缓存
entryFileNames: 'assets/[name]-[hash].js',
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash].[ext]',
manualChunks: (id) => {
// 将所有 SVG 文件打包到一个单独的 chunk 中
// SVG 文件分割策略
if (id.includes('.svg') && id.includes('?react')) {
return 'svg-icons';
// 排除 chunk-method 文件夹的 SVG
if (id.includes('/chunk-method/')) {
// 不打包 chunk-method 的 SVG让它们保持为独立的资源文件
return undefined;
}
// 其他 SVG 文件正常分割
if (id.includes('/llm/')) {
return 'svg-llm';
} else if (id.includes('/file-icon/')) {
return 'svg-file';
} else {
return 'svg-common';
}
}
}
}
}
},
},
server: {
host: '0.0.0.0',