vite-plugin-compression2 weekly downloads statistics
By nonzzz (2 listings) · npm · Vite plugins
a fast vite compression plugin
vite-plugin-compression2 has 222,170 recorded weekly downloads on npm, a decrease of 50.0% over the past 30 days.
It ranks #366 of 2,251 tracked npm listings by weekly downloads.
Over 90 days, weekly downloads changed by -36.6%.
PluginStats has 121 daily observations since Jun 19, 2026; the latest is from Oct 17, 2026.
About vite-plugin-compression2
Install
Usage
Basic Usage
Multiple Algorithms
Custom Algorithm Function
With Tarball
Options
Compression Plugin Options
| params | type | default | description |
| include | string \| RegExp \| Array | /\.(html\|xml\|css\|json\|js\|mjs\|svg\|yaml\|yml\|toml)$/ | Include all assets matching any of these conditions. | | exclude | string \| RegExp \| Array | - | Exclude all assets matching any of these conditions. | | threshold | number | 0 | Only assets bigger than this size are processed (in bytes) | | algorithms | Algorithms | ['gzip', 'brotliCompress'] | Array of compression algorithms or defineAlgorithm results | | filename | string \| function | [path][base].gz or [path][base]. br If algorithm is zstandard be [path][base].zst | The target asset filename pattern | | deleteOriginalAssets | boolean | false | Whether to delete the original assets or not | | skipIfLargerOrEqual | boolean | true | Whether to skip the compression if the result is larger than or equal to the original file | | logLevel | string | info | Control sdout info | | artifacts | function | undefined | Sometimes you need to copy something to the final output. This option may help you. | | scheduler | SchedulerOptions | undefined | Limit concurrency |
Tarball Plugin Options
| params | type | default | description |
| dest | string | - | Destination directory for tarball |
API
defineAlgorithm(algorithm, options?)
Define a compression algorithm with options.
Parameters:
• algorithm: Algorithm name ('gzip' | 'brotliCompress' | 'deflate' | 'deflateRaw' | 'zstandard' | 'gz' | 'br' | 'brotli' | 'zstd') or custom function • options: Compression options for the algorithm
Returns: [algorithm, options] tuple
Examples:
Supported Algorithms
| Algorithm | Aliases | Extension | Node.js Support | Description |
| gzip | gz | .gz | All versions | Standard gzip compression with good balance of speed and ratio | | brotliCompress | brotli, br | .br | All versions | Brotli compression with better compression ratio than gzip | | deflate | - | .gz | All versions | Deflate compression algorithm | | deflateRaw | - | .gz | All versions | Raw deflate compression without headers | | zstandard | zstd | .zst | >= 22.15.0 or >= 23.8.0 | Zstandard compression with excellent speed/ratio balance | | Custom Function | - | Custom | All versions | Your own compression algorithm implementation |
Algorithm Types
The algorithms option accepts:
Migration
If you're upgrading from v1.x, please check the Migration Guide.
Q & A
FAQ
Examples
Basic Gzip Only
Multiple Algorithms with Custom Options
Custom Filename Pattern
Delete Original Files
Size Threshold
Production Deployment
After building your project with compressed assets, you need to configure your web server to serve these pre-compressed files.
Nginx Configuration
Apache Configuration
Performance Tips
Compression Level Selection
Choose compression levels based on your deployment strategy:
Recommendations:
• Development/CI: Level 6 (gzip) or Quality 4-6 (brotli) - faster builds • Production: Level 9 (gzip) or Quality 10-11 (brotli) - best compression • Balance: Level 7-8 (gzip) or Quality 8-9 (brotli) - good compromise
File Size Threshold
Only compress files that benefit from compression:
Why use a threshold?
• Files smaller than 1KB may not benefit from compression • HTTP overhead can make tiny compressed files slower • Saves build time and disk space
Multi-Algorithm Strategy
Use both gzip and brotli for maximum compatibility and performance:
Benefits:
• Brotli: 15-20% better compression than gzip • Gzip: Fallback for older browsers • Server automatically serves the best format based on Accept-Encoding header
Selective Compression
Compress only specific file types for optimal results:
File types that compress well:
• JavaScript/TypeScript (.js, .mjs, .ts) • CSS (.css) • HTML (.html) • JSON (.json) • SVG (.svg) • XML (.xml)
File types to skip:
• Images (.png, .jpg, .webp) - already compressed • Fonts (.woff, .woff2) - already compressed • Videos (.mp4, .webm) - already compressed
Others
• If you want to analyze your bundle assets, try vite-bundle-analyzer • tarball option dest means to generate a tarball somewhere • tarball is based on the ustar format. It should be compatible with all popular tar distributions (gnutar, bsdtar etc)
Node.js Version Requirements
• gzip, brotliCompress, deflate, deflateRaw: All Node.js versions supported • zstd: Requires Node.js >= 22.15.0 or >= 23.8.0
Note: If you try to use zstd compression on an unsupported Node.js version, the plugin will throw a helpful error message indicating the required version.
Sponsors
LICENSE
MIT
Acknowledgements
NWYLZW
Author
Kanno
Description from the npm listing.
- vite
- vite-plugin
- compress
Where vite-plugin-compression2 sits in the listing
Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Recent observations
Full history (121)Similar npm Vite plugins plugins
Data source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-compression2. First seen Oct 16, 2026; last successful collection Oct 18, 2026. See the methodology.