Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-compression

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-compression

Use gzip or brotli to compress resources.

  • 0.2.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
113K
decreased by-3.32%
Maintainers
1
Weekly downloads
 
Created
Source

vite-plugin-compression

English | 中文

npm node

Use gzip or brotli to compress resources.

Since vite-plugin-compress does not support gzip compression, a separate copy has been modified and some functions have been added.

Install (yarn or npm)

node version: >=12.0.0

vite version: >=2.0.0

yarn add vite-plugin-compression -D

or

npm i vite-plugin-compression -D

Usage

  • Configuration plugin in vite.config.ts
import viteCompression from 'vite-plugin-compression';

export default () => {
  return {
    plugins: [viteCompression()],
  };
};

Options

paramstypedefaultdefault
verbosebooleantrueWhether to output the compressed result in the console
filterRegExp or (file: string) => booleanDefaultFilterSpecify which resources are not compressed
disablebooleanfalseWhether to disable
thresholdnumber1025It will be compressed if the volume is larger than threshold, the unit is b
algorithmstringgzipCompression algorithm, optional ['gzip','brotliCompress' ,'deflate','deflateRaw']
extstring.gzSuffix of the generated compressed package
compressionOptionsobject-The parameters of the corresponding compression algorithm
deleteOriginFileboolean-Whether to delete source files after compression

DefaultFilter

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

Example

Run Example


cd ./example

yarn install

yarn test:gzip

yarn test:br

Sample project

Vben Admin

License

MIT

Inspiration

vite-plugin-compress

Keywords

FAQs

Package last updated on 03 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc