Skip to content

Commit ecdc2e9

Browse files
committed
chore: 打包优化
1 parent 017b9b6 commit ecdc2e9

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"typescript": "5.1.6",
6767
"unplugin-auto-import": "^0.16.0",
6868
"vite": "^4.2.1",
69+
"vite-plugin-compression": "^0.5.1",
6970
"vite-plugin-eslint": "^1.8.1",
7071
"vite-plugin-html": "^3.2.0",
7172
"vite-plugin-vue-setup-extend-plus": "^0.1.0",

vite.config.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* @version:
44
* @Author: June
55
* @Date: 2023-04-24 00:25:39
6-
* @LastEditors: 秦少卫
7-
* @LastEditTime: 2024-07-16 14:51:54
6+
* @LastEditors: June
7+
* @LastEditTime: 2024-10-09 23:57:48
88
*/
99
import { defineConfig, loadEnv } from 'vite';
1010
import vue from '@vitejs/plugin-vue';
@@ -16,6 +16,7 @@ import autoImports from 'unplugin-auto-import/vite';
1616
import { resolve } from 'path';
1717
import autoprefixer from 'autoprefixer';
1818
import svgLoader from 'vite-svg-loader';
19+
import viteCompression from 'vite-plugin-compression';
1920

2021
const config = ({ mode }) => {
2122
const isProd = mode === 'production';
@@ -49,6 +50,14 @@ const config = ({ mode }) => {
4950
},
5051
}),
5152
svgLoader(),
53+
viteCompression({
54+
verbose: true,
55+
disable: false,
56+
deleteOriginFile: false,
57+
threshold: 5120,
58+
algorithm: 'gzip',
59+
ext: '.gz',
60+
}),
5261
],
5362
build: {
5463
target: 'es2015',

0 commit comments

Comments
 (0)