• Version 3.1.2
  • Published
  • 23.6 kB
  • No dependencies
  • MIT license


npm i rollup-plugin-gzip
yarn add rollup-plugin-gzip
pnpm add rollup-plugin-gzip


Compress your Rollup / Vite bundle with Gzip or Brotli



function gzipPlugin

gzipPlugin: (explicitOptions?: GzipPluginOptions) => Plugin;


    interface GzipPluginOptions

    interface GzipPluginOptions {}

      property additionalFiles

      additionalFiles?: string[];
      • This option allows you to compress additional files outside of the main rollup bundling process. The processing is delayed to make sure the files are written on disk; the delay is controlled through additionalFilesDelay.

      property additionalFilesDelay

      additionalFilesDelay?: number;
      • This options sets a delay (ms) before the plugin compresses the files specified through additionalFiles. Increase this value if your artifacts take a long time to generate.

        Defaults to 0

      property customCompression

      customCompression?: CustomCompressionOption;
      • Set a custom compression algorithm. The function can either return the compressed contents synchronously, or otherwise return a promise for asynchronous processing.

      property fileName

      fileName?: string | StringMappingOption;
      • Set a custom file name convention for the compressed files. Can be a suffix string or a function returning the file name.

        Defaults to .gz

      property filter

      filter?: RegExp | ((fileName: string) => boolean);
      • Control which of the output files to compress

        Defaults to /\.(js|mjs|json|css|html)$/

      property gzipOptions

      gzipOptions?: ZlibOptions;
      • GZIP compression options, see

      property minSize

      minSize?: number;
      • Specified the minimum size in Bytes for a file to get compressed. Files that are smaller than this threshold will not be compressed. This does not apply to the files specified through additionalFiles!

      Type Aliases

      type CustomCompressionOption

      type CustomCompressionOption = (
      content: string | Buffer
      ) => string | Buffer | Promise<string | Buffer>;

        type StringMappingOption

        type StringMappingOption = (originalString: string) => string;

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (14)

          Peer Dependencies (1)


          To add a badge like this badgeto your package's README, use the codes available below.

          You may also use to create a custom badge linking to

          • Markdown
          • HTML
            <a href=""><img src="" alt=""></a>