build(prd): 优化生产环境构建配置

- 新增生产环境构建命令 build:prd
- 添加 .env.prd 环境变量文件
- 更新 package.json脚本
- 调整 vue.config.js 中的输出文件命名规则
- 优化代码分割配置,增加最大代码块大小
This commit is contained in:
陈昱达
2025-07-25 16:38:44 +08:00
parent 078da9794b
commit 6bb2f56fde
3 changed files with 16 additions and 1 deletions

View File

@@ -145,7 +145,7 @@ module.exports = {
config.optimization.splitChunks({
chunks: 'all',
minSize: 3000,
maxSize: 6000,
maxSize: 9000,
maxInitialRequests: 3,
cacheGroups: {
libs: {
@@ -169,6 +169,10 @@ module.exports = {
}
})
config.optimization.runtimeChunk('single')
// 添加时间戳到文件名中
})
config.output
.filename(`js/[name].[hash:8].js`)
.chunkFilename(`js/[name].[hash:8].js`)
}
}