Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
vite-plugin-compression2
Advanced tools
Readme
This is a compression plugin for vite.
$ yarn add vite-plugin-compression2 -D
# or
$ npm install vite-plugin-compression2 -D
import { defineConfig } from 'vite'
import { compression } from 'vite-plugin-compression2'
export default defineConfig({
plugins: [
// ...your plugin
compression()
]
})
params | type | default | description |
---|---|---|---|
include | string | RegExp | Array<string | RegExp> | - | 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) |
algorithm | string| function | gzip | The compression algorithm |
compressionOptions | Record<string,any> | {} | Compression options for algorithm (details see zlib module ) |
deleteOriginalAssets | boolean | false | Whether to delete the original assets or not |
filename | string | [path][base].gz | The target asset filename |
Why not vite-plugin-compression
vite-plugin-compression
no longer maintenance.Why vite-plugin-compression2
vite-plugin-compression
has minimal dependencies and better performance.Can i custom the compression algorithm?
Can i generate multiple compressed assets with difference compression algorithm?
import { defineComponent } from 'vite'
import { compression } from 'vite-plugin-compression2'
export default defineComponent({
plugins: [
// ...your plugin
compression(),
compression({ algorithm: 'brotliCompress', exclude: [/\.(br)$/, /\.(gz)$/], deleteOriginalAssets: true })
]
})
exclude
for the latest compression plugin. ( Becasue in the full bundle process. Bundle chunk is shared. And
there are write (delete) operations on the bundle inside the plugin. So you should ignore the compressed chunk :) If you want delete
the original assets you also follow the way.Kanno
FAQs
a fast vite compression plugin
The npm package vite-plugin-compression2 receives a total of 18,722 weekly downloads. As such, vite-plugin-compression2 popularity was classified as popular.
We found that vite-plugin-compression2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.