From fb420fa1b130aeeed647fa77505ae10a49635b9e Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Sun, 5 Jun 2022 23:49:48 +0800 Subject: [PATCH] Compress SVG when building dist --- config/vite.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/vite.config.js b/config/vite.config.js index 9a0c97d3e..59cbe446e 100644 --- a/config/vite.config.js +++ b/config/vite.config.js @@ -7,6 +7,8 @@ import viteCompression from "vite-plugin-compression"; const postCssScss = require("postcss-scss"); const postcssRTLCSS = require("postcss-rtlcss"); +const viteCompressionFilter = /\.(js|mjs|json|css|html|svg)$/i; + // https://vitejs.dev/config/ export default defineConfig({ plugins: [ @@ -20,9 +22,11 @@ export default defineConfig({ }), viteCompression({ algorithm: "gzip", + filter: viteCompressionFilter, }), viteCompression({ algorithm: "brotliCompress", + filter: viteCompressionFilter, }), ], css: {