Browse Source
Merge pull request #37 from wkclz/master
不配置 VITE_BUILD_COMPRESS 情况下,不自动压缩编译产物
master
若依
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
20 additions and
18 deletions
-
vite/plugins/compression.js
|
|
|
@ -2,8 +2,9 @@ import compression from 'vite-plugin-compression' |
|
|
|
|
|
|
|
export default function createCompression(env) { |
|
|
|
const { VITE_BUILD_COMPRESS } = env |
|
|
|
const compressList = VITE_BUILD_COMPRESS.split(',') |
|
|
|
const plugin = [] |
|
|
|
if (VITE_BUILD_COMPRESS) { |
|
|
|
const compressList = VITE_BUILD_COMPRESS.split(',') |
|
|
|
if (compressList.includes('gzip')) { |
|
|
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
|
|
|
plugin.push( |
|
|
|
@ -22,5 +23,6 @@ export default function createCompression(env) { |
|
|
|
}) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
return plugin |
|
|
|
} |
|
|
|
|