rollup-plugin-zipdir
Version:
Rollup plugin to zip the entire output directory
48 lines (35 loc) • 1.28 kB
Markdown
[](https://rollupjs.org/) plugin to zip the entire output directory using [`fflate`](https://github.com/101arrowz/fflate/).
Designed as an alternative to [`rollup-plugin-zip`](https://github.com/mentaljam/rollup-plugin-zip). More info [here](#inspiration)
```cmd
pnpm add rollup-plugin-zipdir -D
yarn add rollup-plugin-zipdir -D
npm i rollup-plugin-zipdir -D
```
```js
// rollup.config.js
import zipDir from 'rollup-plugin-zipdir';
export default {
input: 'src/index.js',
output: {
dir: 'build',
format: 'esm',
},
plugins: [
// zipDir should be the last plugin
zipDir({
outputDir: 'dist',
}),
],
};
```
Designed as an alternative to [`rollup-plugin-zip`](https://github.com/mentaljam/rollup-plugin-zip). Main differences:
- Uses [`fflate`](https://github.com/101arrowz/fflate/) instead of [`yazl`](https://github.com/thejoshwolfe/yazl)
- Reads files from the output directory itself (on disk), rather than the [Rollup-provided assets](https://rollupjs.org/guide/en/#generatebundle)
- Operates as late as possible in the Rollup [output generation phase](https://rollupjs.org/guide/en/#output-generation-hooks)