gzip.ts 444 B

1234567891011121314151617
  1. /**
  2. * Used to package and output gzip. Note that this does not work properly in Vite, the specific reason is still being investigated
  3. */
  4. import type { Plugin } from 'vite';
  5. import gzipPlugin from 'rollup-plugin-gzip';
  6. import { isBuildGzip } from '../../utils';
  7. export function configGzipPlugin(isBuild: boolean): Plugin | Plugin[] {
  8. const useGzip = isBuild && isBuildGzip();
  9. if (useGzip) {
  10. return gzipPlugin();
  11. }
  12. return [];
  13. }