Commit 0a81fa1e authored by zhangdd's avatar zhangdd

chore:config compression

Signed-off-by: default avatarzhangdd <86431843@qq.com>
parent b009735e
......@@ -18,7 +18,8 @@
"devDependencies": {
"@babel/core": "^7.17.8",
"@vue/cli-plugin-babel": "~5.0.3",
"@vue/cli-service": "^5.0.3"
"@vue/cli-service": "^5.0.3",
"compression-webpack-plugin": "^9.2.0"
},
"browserslist": [
"> 1%",
......@@ -26,4 +27,4 @@
"not dead",
"not ie 11"
]
}
\ No newline at end of file
}
const { defineConfig } = require('@vue/cli-service')
const {defineConfig} = require('@vue/cli-service')
const CompressionPlugin = require("compression-webpack-plugin")
module.exports = defineConfig({
transpileDependencies: true
transpileDependencies: true,
chainWebpack: (config) => {
config.plugin('compressionPlugin')
.use(new CompressionPlugin({
test: /\.js$|\.html$|\.css/, // 匹配文件名
threshold: 10240, // 对超过10k的数据压缩
deleteOriginalAssets: false // 不删除源文件
}))
}
})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment