From 54ed748ae9ef2bd2b5d155faad48c5a43866159c Mon Sep 17 00:00:00 2001 From: yuntian001 <479820787@qq.com> Date: Tue, 6 Sep 2022 22:48:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E4=B8=8Agzip=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + vite.config.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e4fbb989..1172f7bf 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "unplugin-vue-components": "^0.22.4", "vite": "^3.0.0", "vite-plugin-autogeneration-import-file": "^2.1.0", + "vite-plugin-compression": "^0.5.1", "vite-plugin-mock": "^2.9.6", "vite-svg-loader": "^3.4.0", "vue-eslint-parser": "^9.0.3", diff --git a/vite.config.ts b/vite.config.ts index 5aa87bc3..e78364b9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ import { autoImport, resolver } from 'vite-plugin-autogeneration-import-file'; import vueSetUpExtend from './plugin/vueSetupExtend'; import { viteMockServe } from 'vite-plugin-mock'; import { ConfigEnv, UserConfigExport } from 'vite'; -import { visualizer } from 'rollup-plugin-visualizer'; +import { visualizer } from 'rollup-plugin-visualizer'; //打包大小分析(stats.html) import AutoImport from 'unplugin-auto-import/vite'; import Components from 'unplugin-vue-components/vite'; import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'; @@ -15,6 +15,7 @@ import { splitVendorChunkPlugin } from 'vite'; import autoprefixer from 'autoprefixer'; // @ts-ignore import px2rem from 'postcss-plugin-px2rem'; +import viteCompression from 'vite-plugin-compression'; //打包压缩 // @ts-ignore import { loadMessageConfig } from './src/config/locale'; function pathResolve(dir: string) { @@ -127,6 +128,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { }, ]), visualizer(), + viteCompression(), ], css: { preprocessorOptions: {