Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iamspark1e/unplugin-zip-pack
Zip your build files with JSZip, filtered by your rules, powered by unplugin
https://github.com/iamspark1e/unplugin-zip-pack
rollup unplugin vite webpack zip-pack
Last synced: about 2 months ago
JSON representation
Zip your build files with JSZip, filtered by your rules, powered by unplugin
- Host: GitHub
- URL: https://github.com/iamspark1e/unplugin-zip-pack
- Owner: iamspark1e
- License: mit
- Created: 2023-08-10T13:45:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-26T18:39:37.000Z (about 2 months ago)
- Last Synced: 2024-11-26T19:32:58.113Z (about 2 months ago)
- Topics: rollup, unplugin, vite, webpack, zip-pack
- Language: TypeScript
- Homepage:
- Size: 1.52 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - unplugin-zip-pack - Zip your dist with filter function support. (Plugins / Framework-agnostic Plugins)
- awesome-vite - unplugin-zip-pack - Zip your dist with filter function support. (Plugins / Framework-agnostic Plugins)
README
unplugin-zip-pack
Zip your build files with JSZip, powered by unplugin
使用JSZip打包构建成果,由unplugin驱动
## Quick Start
```bash
npm i unplugin-zip-pack@latest -D # Or yarn/pnpm as you like
```## Configuration
```typescript
export type Options = {
/**
* Input Dir
* @default `./dist`
*/
in?: string;
/**
* Output file name (with path)
* @default `dist.zip`
*/
out?: string;
filter?: FilterFunction;
/**
* Switcher of enable plugin
* @default true
*/
enabled?: boolean;
/**
* Hook functions run pre/post compress. (if `enabled` is set to false, hooks won't run.)
*/
hooks?: {
pre?: Promise;
post?: Promise;
}
}
```## Usage
Vite
```ts
// vite.config.ts
import ZipPack from 'unplugin-zip-pack/vite'export default defineConfig({
plugins: [
ZipPack({ /* options */ }),
],
})
```
Rollup
```ts
// rollup.config.js
import ZipPack from 'unplugin-zip-pack/rollup'export default {
plugins: [
ZipPack({ /* options */ }),
],
}
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-zip-pack/webpack')({ /* options */ })
]
}
```
Nuxt
```ts
// nuxt.config.js
export default {
buildModules: [
['unplugin-zip-pack/nuxt', { /* options */ }],
],
}
```> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)
Vue CLI
```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-zip-pack/webpack')({ /* options */ }),
],
},
}
```
esbuild
```ts
// esbuild.config.js
import { build } from 'esbuild'
import ZipPack from 'unplugin-zip-pack/esbuild'build({
plugins: [ZipPack()],
})
```