Skip to content

Commit

Permalink
chore: 打包优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiu-Jun committed Oct 9, 2024
1 parent 017b9b6 commit ecdc2e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"typescript": "5.1.6",
"unplugin-auto-import": "^0.16.0",
"vite": "^4.2.1",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-vue-setup-extend-plus": "^0.1.0",
Expand Down
13 changes: 11 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @version:
* @Author: June
* @Date: 2023-04-24 00:25:39
* @LastEditors: 秦少卫
* @LastEditTime: 2024-07-16 14:51:54
* @LastEditors: June
* @LastEditTime: 2024-10-09 23:57:48
*/
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
Expand All @@ -16,6 +16,7 @@ import autoImports from 'unplugin-auto-import/vite';
import { resolve } from 'path';
import autoprefixer from 'autoprefixer';
import svgLoader from 'vite-svg-loader';
import viteCompression from 'vite-plugin-compression';

const config = ({ mode }) => {
const isProd = mode === 'production';
Expand Down Expand Up @@ -49,6 +50,14 @@ const config = ({ mode }) => {
},
}),
svgLoader(),
viteCompression({
verbose: true,
disable: false,
deleteOriginFile: false,
threshold: 5120,
algorithm: 'gzip',
ext: '.gz',
}),
],
build: {
target: 'es2015',
Expand Down

0 comments on commit ecdc2e9

Please sign in to comment.