Registry / devops / rollup-plugin-gzip

rollup-plugin-gzip

JSON →
library4.2.0jsnpmunverified

A Rollup/Vite plugin that creates compressed .gz and .br artifacts from bundle output files. Current version is 4.2.0, with major releases every 1-2 years. Supports both gzip (via Node's zlib) and custom compression algorithms (Brotli, Zopfli). Key differentiators: built-in Brotli support via custom compression, file size threshold filtering, additional file compression, and compatibility with Vite and Rollup (>=2.0.0). TypeScript types included.

npm install rollup-plugin-gzip
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-GZIP
R
rollup-plugin-gzip
devopsjavascriptv4.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gzipPlugin
import gzipPlugin from 'rollup-plugin-gzip'
const gzipPlugin = require('rollup-plugin-gzip')
Default export only. In CommonJS, use require('rollup-plugin-gzip').default.

Minimal Rollup config to compress output with default gzip. Shows import and plugin usage.

// rollup.config.js import gzipPlugin from 'rollup-plugin-gzip'; import { brotliCompress } from 'zlib'; import { promisify } from 'util'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ gzipPlugin() // defaults: .gz, minSize optional ] };
Debug
Known issues
breakingv4.0.0 switched to type: "module". Import syntax changed; CommonJS users must use dynamic import or upgrade.
fix
Use ESM imports: import gzipPlugin from 'rollup-plugin-gzip'; or const gzipPlugin = (await import('rollup-plugin-gzip')).default;
affects: >=4.0.0
breakingv3.0.0 dropped support for Rollup versions < 2.0.0.
fix
Upgrade Rollup to >=2.0.0, or use v2.x of this plugin.
affects: >=3.0.0
gotchaIf using Brotli compression with Node < 11.7.0, you need the external 'brotli' package.
fix
Use Node >=11.7.0 or install 'brotli' from npm and use it as customCompression.
affects: *
gotchaThe 'gzipOptions' object is passed directly to Node's zlib. Options like 'level' and 'memLevel' are supported, but incorrect values may cause errors.
fix
Refer to https://nodejs.org/api/zlib.html#zlib_class_options for valid options.
affects: *
breakingv2.5.1 fails build when detecting incompatible Vite bundle to force upgrade to v3.x.
fix
Upgrade to v3.x or above.
affects: 2.5.1
deprecatedThe 'additionalFilesDelay' option is deprecated for Rollup >=2.0.0 (defaults to 0).
fix
Remove the option or set to 0.
affects: >=4.0.0
Errors
Common errors & fixes
Error: gzipPlugin is not a function
CommonJS require returns an ES module with default as object property.
fix
Use const gzipPlugin = require('rollup-plugin-gzip').default; or switch to ESM import.
Error: Cannot find module 'rollup-plugin-gzip'
Package not installed.
fix
Run npm install --save-dev rollup-plugin-gzip
Error: [plugin:gzip] Failed to compress with brotli: 'brotliCompress' is not a function
Using Node <11.7.0 with built-in brotli.
fix
Upgrade Node to >=11.7.0 or install 'brotli' package and use it as customCompression.
Error: Rollup version 1.x is not supported, please upgrade to 2.x or higher
Using outdated Rollup version.
fix
Upgrade Rollup to >=2.0.0 or use v2.x of this plugin.
Upgrade
Version history
4.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Resources
rollup-plugin-gzip — npm install rollup-plugin-gzip · libregistry