Skip to content

Commit f1fcdf2

Browse files
perf: Optimize packaging
1 parent 4229b47 commit f1fcdf2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"screenfull": "^6.0.2",
4545
"sortablejs": "^1.15.6",
4646
"use-element-plus-theme": "^0.0.5",
47+
"vite-plugin-compression": "^0.5.1",
4748
"vite-plugin-html": "^3.2.2",
4849
"vue": "^3.5.13",
4950
"vue-clipboard3": "^2.0.0",

ui/vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
66
import DefineOptions from 'unplugin-vue-define-options/vite'
77
import path from 'path'
88
import { createHtmlPlugin } from 'vite-plugin-html'
9+
import viteCompression from 'vite-plugin-compression'
910
import fs from 'fs'
1011
// import vueDevTools from 'vite-plugin-vue-devtools'
1112
const envDir = './env'
@@ -87,6 +88,14 @@ export default defineConfig((conf: any) => {
8788
DefineOptions(),
8889
createHtmlPlugin({ template: ENV.VITE_ENTRY }),
8990
renameHtmlPlugin(`dist${ENV.VITE_BASE_PATH}`, ENV.VITE_ENTRY),
91+
viteCompression({
92+
// gzip静态资源压缩配置
93+
verbose: true, // 是否在控制台输出压缩结果
94+
disable: false, // 是否禁用压缩
95+
threshold: 10240, // 启用压缩的文件大小限制
96+
algorithm: 'gzip', // 采用的压缩算法
97+
ext: '.gz', // 生成的压缩包后缀
98+
}),
9099
],
91100
server: {
92101
cors: true,

0 commit comments

Comments
 (0)