Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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 1 month ago
JSON representation

Zip your build files with JSZip, filtered by your rules, powered by unplugin

Awesome Lists containing this project

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()],
})
```