mirror of
https://github.com/yangzongzhuan/RuoYi-Cloud-Vue3.git
synced 2025-05-29 20:19:00 +00:00
不配置 VITE_BUILD_COMPRESS 情况下,不自动压缩编译产物
This commit is contained in:
parent
4071203526
commit
c1a1eaaa21
@ -2,25 +2,27 @@ 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 (compressList.includes('gzip')) {
|
||||
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#ʹÓÃgzip½âѹËõ¾²Ì¬Îļþ
|
||||
plugin.push(
|
||||
compression({
|
||||
ext: '.gz',
|
||||
deleteOriginFile: false
|
||||
})
|
||||
)
|
||||
}
|
||||
if (compressList.includes('brotli')) {
|
||||
plugin.push(
|
||||
compression({
|
||||
ext: '.br',
|
||||
algorithm: 'brotliCompress',
|
||||
deleteOriginFile: false
|
||||
})
|
||||
)
|
||||
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(
|
||||
compression({
|
||||
ext: '.gz',
|
||||
deleteOriginFile: false
|
||||
})
|
||||
)
|
||||
}
|
||||
if (compressList.includes('brotli')) {
|
||||
plugin.push(
|
||||
compression({
|
||||
ext: '.br',
|
||||
algorithm: 'brotliCompress',
|
||||
deleteOriginFile: false
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
return plugin
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user