diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json
index ce0ddd205..2ae3cdf3c 100644
--- a/yudao-ui-admin-vue3/package.json
+++ b/yudao-ui-admin-vue3/package.json
@@ -93,6 +93,7 @@
"typescript": "4.7.4",
"unplugin-vue-define-options": "^0.6.2",
"vite": "3.0.2",
+ "vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.7.0",
"vite-plugin-html": "^3.2.0",
"vite-plugin-purge-icons": "^0.8.1",
diff --git a/yudao-ui-admin-vue3/vite.config.ts b/yudao-ui-admin-vue3/vite.config.ts
index a40d281b4..f849f8d09 100644
--- a/yudao-ui-admin-vue3/vite.config.ts
+++ b/yudao-ui-admin-vue3/vite.config.ts
@@ -11,6 +11,7 @@ import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import PurgeIcons from 'vite-plugin-purge-icons'
import DefineOptions from 'unplugin-vue-define-options/vite'
import { createHtmlPlugin } from 'vite-plugin-html'
+import viteCompression from 'vite-plugin-compression'
// 当前执行node命令时文件夹的地址(工作目录)
const root = process.cwd()
@@ -80,11 +81,19 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
}),
PurgeIcons(),
DefineOptions(),
+ viteCompression({
+ verbose: true, // 是否在控制台输出压缩结果
+ disable: true, // 是否禁用
+ threshold: 10240, // 体积大于 threshold 才会被压缩,单位 b
+ algorithm: 'gzip', // 压缩算法,可选 [ 'gzip' , 'brotliCompress' ,'deflate' , 'deflateRaw']
+ ext: '.gz', // 生成的压缩包后缀
+ deleteOriginFile: false //压缩后是否删除源文件
+ }),
createHtmlPlugin({
inject: {
data: {
title: env.VITE_APP_TITLE,
- injectScript: ``,
+ injectScript: ``
}
}
})