mirror of
http://112.124.100.131/ebiz-ai/ebiz-ai-knowledge-manage.git
synced 2025-12-08 02:16:49 +08:00
build(prd): 优化生产环境构建配置
- 新增生产环境构建命令 build:prd - 添加 .env.prd 环境变量文件 - 更新 package.json脚本 - 调整 vue.config.js 中的输出文件命名规则 - 优化代码分割配置,增加最大代码块大小
This commit is contained in:
9
.env.prd
Normal file
9
.env.prd
Normal file
@@ -0,0 +1,9 @@
|
||||
# env
|
||||
NODE_ENV = 'prd' // 如果是生产环境,请记得切换为production
|
||||
|
||||
# flag
|
||||
VUE_APP_FLAG='prd'
|
||||
VUE_APP_ADMIN='http://39.104.123.254:7196'
|
||||
VUE_APP_STATIC='http://39.104.123.254:7536/'
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"serve": "NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"build:dev": "vue-cli-service build --mode dev",
|
||||
"build:prd": "vue-cli-service build --mode prd",
|
||||
"dev": "vue-cli-service serve --mode dev",
|
||||
"preview": "node build/index.js --preview",
|
||||
"lint": "eslint --ext .js,.vue src",
|
||||
@@ -19,6 +20,7 @@
|
||||
"dependencies": {
|
||||
"alova": "^3.2.10",
|
||||
"axios": "0.18.1",
|
||||
"compression-webpack-plugin": "^6.1.2",
|
||||
"cropperjs": "^2.0.0",
|
||||
"crypto-js": "^4.0.0",
|
||||
"crypto.js": "^2.0.2",
|
||||
|
||||
@@ -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`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user