vite-plugin-sharp

JSON →
library 1.6.3 ·javascript
verified Jun 4, 2026

A zero-config Vite plugin for compressing images at build time using sharp (JPEG/PNG/WebP/AVIF/TIFF/GIF) and SVGO (SVG). Active, stable v1.6.3 with support for Vite 4+. Works on both bundle-asset and public/ directory images. Outperforms imagemin-based alternatives by 4-5x due to libvips native bindings. Features include content-hash caching, include/exclude filters, min-ratio/size thresholds, resize without enlargement, configurable concurrency, and per-format compression settings. Transparent terminal output showing before/after sizes per file. Ships TypeScript types.