不配置 VITE_BUILD_COMPRESS 情况下,不自动压缩编译产物
This commit is contained in:
parent
bab9941aac
commit
639f4656f2
|
@ -2,25 +2,27 @@ import compression from 'vite-plugin-compression'
|
||||||
|
|
||||||
export default function createCompression(env) {
|
export default function createCompression(env) {
|
||||||
const { VITE_BUILD_COMPRESS } = env
|
const { VITE_BUILD_COMPRESS } = env
|
||||||
const compressList = VITE_BUILD_COMPRESS.split(',')
|
|
||||||
const plugin = []
|
const plugin = []
|
||||||
if (compressList.includes('gzip')) {
|
if (VITE_BUILD_COMPRESS) {
|
||||||
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
const compressList = VITE_BUILD_COMPRESS.split(',')
|
||||||
plugin.push(
|
if (compressList.includes('gzip')) {
|
||||||
compression({
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
||||||
ext: '.gz',
|
plugin.push(
|
||||||
deleteOriginFile: false
|
compression({
|
||||||
})
|
ext: '.gz',
|
||||||
)
|
deleteOriginFile: false
|
||||||
}
|
})
|
||||||
if (compressList.includes('brotli')) {
|
)
|
||||||
plugin.push(
|
}
|
||||||
compression({
|
if (compressList.includes('brotli')) {
|
||||||
ext: '.br',
|
plugin.push(
|
||||||
algorithm: 'brotliCompress',
|
compression({
|
||||||
deleteOriginFile: false
|
ext: '.br',
|
||||||
})
|
algorithm: 'brotliCompress',
|
||||||
)
|
deleteOriginFile: false
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return plugin
|
return plugin
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue