mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 14:13:40 +08:00
chore: optimize prod configuration to control whether to delete origin files when using compress plugin (#443)
This commit is contained in:
@@ -6,7 +6,10 @@ import type { Plugin } from 'vite';
|
||||
|
||||
import compressPlugin from 'vite-plugin-compression';
|
||||
|
||||
export function configCompressPlugin(compress: 'gzip' | 'brotli' | 'none'): Plugin | Plugin[] {
|
||||
export function configCompressPlugin(
|
||||
compress: 'gzip' | 'brotli' | 'none',
|
||||
deleteOriginFile: boolean = false
|
||||
): Plugin | Plugin[] {
|
||||
const compressList = compress.split(',');
|
||||
|
||||
const plugins: Plugin[] = [];
|
||||
@@ -15,6 +18,7 @@ export function configCompressPlugin(compress: 'gzip' | 'brotli' | 'none'): Plug
|
||||
plugins.push(
|
||||
compressPlugin({
|
||||
ext: '.gz',
|
||||
deleteOriginFile,
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -23,6 +27,7 @@ export function configCompressPlugin(compress: 'gzip' | 'brotli' | 'none'): Plug
|
||||
compressPlugin({
|
||||
ext: '.br',
|
||||
algorithm: 'brotliCompress',
|
||||
deleteOriginFile,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user