Vite Zipper
raw JSON → 0.3.15 verified Mon Apr 27 auth: no javascript
Vite Zipper (v0.3.15) is a Vite plugin that zips build outputs into a single archive file, streamlining deployment workflows. It supports custom output filenames, and TypeScript types are included. Requires Node.js >=18 and Vite ^7.0.0 as a peer dependency. Compared to alternatives like 'vite-plugin-zip-pack' or 'vite-plugin-zip-dist', it offers a simpler API with out-of-the-box TypeScript support and active maintenance on GitHub. Released under the MIT license, it follows a monthly release cadence.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module not supported ↓
cause Using CommonJS require() on an ESM-only package.
fix
Change to import statement: import { viteZipper } from 'vite-zipper'; or use dynamic import: const { viteZipper } = await import('vite-zipper');
error TypeError: viteZipper is not a function ↓
cause Importing the plugin incorrectly, e.g., using default import with the wrong name, or importing a non-existent export.
fix
Ensure you are using the named export: import { viteZipper } from 'vite-zipper'; or the default export: import viteZipper from 'vite-zipper';
error Error: The plugin 'vite-zipper' requires Vite ^7.0.0 but the current Vite version is x.y.z ↓
cause Installed Vite version is older than required peer dependency.
fix
Upgrade Vite to version 7.x: npm install vite@7
Warnings
breaking Package is ESM-only and requires Node.js >=18. Using require() will throw a runtime error. ↓
fix Use import syntax and ensure Node.js >=18. For legacy projects, upgrade Node or use dynamic import().
deprecated In version 0.2.x, the plugin exported a default function under 'vite-zipper' but with different option names. ↓
fix Upgrade to v0.3.15 and update option names: old 'outputDir' is now 'outputPath', old 'fileName' is now 'archiveName'.
gotcha The plugin only runs during production builds; it does not affect the dev server or watch mode. ↓
fix If you need to zip during dev, consider using a different approach or triggering a build on demand.
gotcha If the output archive already exists, it will be overwritten without warning. There is no conflict detection. ↓
fix Ensure your build process cleans the output directory or uses unique archive names to avoid accidental overwrites.
Install
npm install vite-zipper yarn add vite-zipper pnpm add vite-zipper Imports
- viteZipper wrong
const viteZipper = require('vite-zipper')correctimport { viteZipper } from 'vite-zipper' - PluginOptions wrong
import { PluginOptions } from 'vite-zipper'correctimport type { PluginOptions } from 'vite-zipper' - default wrong
import { default as viteZipper } from 'vite-zipper'correctimport viteZipper from 'vite-zipper'
Quickstart
// vite.config.ts
import { defineConfig } from 'vite';
import { viteZipper } from 'vite-zipper';
export default defineConfig({
plugins: [
viteZipper({ outputPath: 'dist', archiveName: 'my-site.zip' }),
],
});
// After running 'vite build', outputs are zipped into 'dist/my-site.zip'.