vite-plugin-compression2 weekly downloads statistics
By nonzzz (2 listings) · npm · Vite plugins
a fast vite compression plugin
vite-plugin-compression2 has 766,427 recorded weekly downloads on npm, an increase of 15.6% over the past 30 days, ranking #321 of 3,247 tracked listings.
About vite-plugin-compression2
Install
$ yarn add vite-plugin-compression2 -D
# or
$ npm install vite-plugin-compression2 -D
# or
$ pnpm add vite-plugin-compression2 -D
Usage
Basic Usage
import { defineConfig } from 'vite'
import { compression } from 'vite-plugin-compression2'
export default defineConfig({
plugins: [
// ...your plugins
compression()
]
})
Multiple Algorithms
import { compression, defineAlgorithm } from 'vite-plugin-compression2'
export default defineConfig({
plugins: [
compression({
algorithms: [
'gzip',
'brotliCompress',
defineAlgorithm('deflate', { level: 9 })
]
})
]
})
Custom Algorithm Function
import { compression, defineAlgorithm } from 'vite-plugin-compression2'
export default defineConfig({
plugins: [
compression({
algorithms: [
defineAlgorithm(
async (buffer, options) => {
// Your custom compression logic
return compressedBuffer
},
{ customOption: true }
)
]
})
]
})
With Tarball
import { compression, tarball } from 'vite-plugin-compression2'
export default defineConfig({
plugins: [
compression(),
// If you want to create a tarball archive, use tarball plugin after compression
tarball({ dest: './dist/archive' })
]
})
Options
Compression Plugin Options
| params | type | default | description |
|---|---|---|---|
include | string | RegExp | Array<string | RegExp> | /\.(html|xml|css|json|js|mjs|svg|yaml|yml|toml)$/ | Include all assets matching any of these conditions. |
exclude | string | RegExp | Array<string | RegExp> | - | 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 functionoptions: Compression options for the algorithm
Returns: [algorithm, options] tuple
Examples:
// Built-in algorithm with default options
defineAlgorithm('gzip')
// Built-in algorithm with custom options
defineAlgorithm('gzip', { level: 9 })…
Description from the npm listing.
- vite
- vite-plugin
- compress
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
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.
Each band is one page of 20. Weekly downloads on a linear 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.
Recent observations
Full history (170)Similar npm Vite plugins plugins
All 20 vite-plugin-compression2 alternativesData 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 Dec 6, 2026. See the methodology.