index.ts 342 B

123456789101112131415161718
  1. import compressPlugin from 'vite-plugin-compression'
  2. export const createCompress = (compress: any) => {
  3. if (compress === 'brotli') {
  4. return compressPlugin({
  5. ext: '.br',
  6. algorithm: 'brotliCompress',
  7. })
  8. }
  9. if (compress === 'gzip' || compress) {
  10. return compressPlugin({
  11. ext: '.gz',
  12. })
  13. }
  14. return []
  15. }