From ecdc2e9a995510600a2b36c69bc3f1db4b098ac7 Mon Sep 17 00:00:00 2001 From: June <1601745371@qq.com> Date: Wed, 9 Oct 2024 23:58:27 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=89=93=E5=8C=85=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + vite.config.ts | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2efa77b0..d51c0b93 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/vite.config.ts b/vite.config.ts index 2eeb80f9..c20d4e98 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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'; @@ -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'; @@ -49,6 +50,14 @@ const config = ({ mode }) => { }, }), svgLoader(), + viteCompression({ + verbose: true, + disable: false, + deleteOriginFile: false, + threshold: 5120, + algorithm: 'gzip', + ext: '.gz', + }), ], build: { target: 'es2015',