From d4e4034c705431de0b355f50c4858f87d2d8d1ce Mon Sep 17 00:00:00 2001 From: none Date: Tue, 21 Mar 2023 13:55:20 +0800 Subject: [PATCH] =?UTF-8?q?gzip=E5=8E=8B=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- package.json | 1 + vite.config.ts | 12 +++++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index e0d1c84..775bdd3 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + Vite + React + TS diff --git a/package.json b/package.json index ddbcf01..1d96edf 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", "@vitejs/plugin-react-swc": "^3.0.0", + "rollup-plugin-gzip": "^3.1.0", "sass": "^1.59.3", "typescript": "^4.9.3", "vite": "^4.2.0" diff --git a/vite.config.ts b/vite.config.ts index 861b04b..1d79d9f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,13 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react-swc' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react-swc"; +import gzipPlugin from "rollup-plugin-gzip"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], -}) + build: { + rollupOptions: { + plugins: [gzipPlugin()], + }, + } +});