mirror of
https://github.com/yangzongzhuan/RuoYi-Cloud-Vue3.git
synced 2025-09-25 06:34:03 +00:00
27 lines
765 B
JavaScript
27 lines
765 B
JavaScript
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
|
|
})
|
|
)
|
|
}
|
|
return plugin
|
|
}
|