vite-plugin-auto-zip

raw JSON →
1.2.0 verified Mon Apr 27 auth: no javascript

A Vite plugin that automatically zips the dist directory after a production build. Current stable version is 1.2.0. It is a simple plugin that runs on build completion and creates a zip archive of the output folder. It offers configurable output zip name, target folder, and destination folder. Its key differentiator is simplicity — it does one thing and has minimal configuration (three parameters). It ships TypeScript types. Development appears sporadic (single contributor, no recent commits). Use cases are limited but straightforward.

error Cannot find module 'vite-plugin-auto-zip'
cause Package not installed or typo in import path.
fix
Run 'npm install vite-plugin-auto-zip' and check import statement is correct.
error AutoZip is not a function
cause Using named import instead of default import.
fix
Use 'import AutoZip from ...' instead of 'import { AutoZip } from ...'.
error The plugin does not zip, no errors in console
cause Plugin runs only on production build, not dev server.
fix
Run 'vite build' to trigger the plugin.
breaking In v1.2.0, the parameter order changed: outName is now the first parameter instead of the third.
fix Update calls from AutoZip('./dist', 'dist.zip') to AutoZip('dist.zip', './dist') or use the new default: AutoZip() produces 'dist.zip' from './dist'.
gotcha AutoZip must be the last plugin in the plugins array to ensure it runs after all other build steps.
fix Always place AutoZip() as the last entry in the plugins array in vite.config.
gotcha The plugin only runs in production mode (vite build), not during dev (vite dev).
fix No change needed — this is by design. If you need zipping in dev, consider a different approach.
gotcha The plugin uses the archiver package under the hood, but it is bundled — no extra install needed.
fix No action required.
npm install vite-plugin-auto-zip
yarn add vite-plugin-auto-zip
pnpm add vite-plugin-auto-zip

Basic setup: import AutoZip (default), place as last plugin in vite.config, optional params for zip name, source folder, output folder.

// vite.config.ts
import { defineConfig } from 'vite';
import AutoZip from 'vite-plugin-auto-zip';

export default defineConfig({
  plugins: [
    // AutoZip should be the last plugin
    AutoZip('myapp.zip', './dist', './dist')
  ]
});