Skip to content
PluginStats

vite-plugin-image-optimizer weekly downloads statistics

By FatehAK · npm · Vite plugins

A Vite plugin to optimize your image assets using Sharp.js and SVGO

View on npm Fresh · Dec 6, 2026

vite-plugin-image-optimizer has 364,131 recorded weekly downloads on npm, a decrease of 2.5% over the past 30 days, ranking #438 of 3,247 tracked listings.

Weekly downloads
364,131
Official API · Dec 5, 2026
7-day growth
+11.5%
+37.4K weekly downloads
30-day growth
-2.5%
-9.5K weekly downloads
90-day growth
+50.6%
+122.3K weekly downloads
Rank
#438
▼ 1 in 7 days

About vite-plugin-image-optimizer

<div align="center"> <a href="https://vitejs.dev/"> <img width="200" height="200" hspace="10" src="https://vitejs.dev/logo.svg" alt="vite logo" /> </a> <h1>Vite Image Optimizer</h1> <p> Plugin for <a href="https://vitejs.dev/">Vite</a> to optimize all images assets using <a href="https://github.com/lovell/sharp">Sharp.js</a> and <a href="https://github.com/svg/svgo">SVGO</a> at build time. </p> <img src="https://img.shields.io/node/v/vite-plugin-image-optimizer" alt="node-current" /> <img src="https://img.shields.io/npm/dependency-version/vite-plugin-image-optimizer/peer/vite" alt="npm peer dependency version" /> <img src="https://img.shields.io/bundlephobia/minzip/vite-plugin-image-optimizer?label=minfied" alt="npm bundle size"/> <img src="https://img.shields.io/github/v/release/fatehak/vite-plugin-image-optimizer" alt="GitHub release" /> <img src="https://img.shields.io/npm/l/vite-plugin-image-optimizer" alt="licence" /> </div> <p>&nbsp;</p>

Features

  • Optimize SVG assets using SVGO and pass custom configs.
  • Optimize Raster assets (png, jpeg, gif, tiff, webp, avif) using Sharp.js with the option to pass custom configs for each extension type.
  • Option to process all assets from your public directory defined in the bundler.
  • Configure test, include, and exclude to filter assets.
  • Caching support to avoid re-optimization (optional)
  • Skips processing assets if their optimized size is greater than their original size.
  • Log the optimization stats showing the before and after size difference, ratio and total savings (optional) terminal output image

Motivation

This plugin is based on the awesome image-minimizer-webpack-plugin for Webpack. I wanted to combine the optimization capabilities of Sharp.js and SVGO in a single package and I couldn't find a plugin for Vite that could accomplish this. I initially thought of adding squoosh and imagemin support as well but dropped the idea since they are no longer maintained.

If you find the plugin useful, consider showing your support by giving a ⭐

Contributions are most welcome! We follow conventional-commits

Installation

You can add it as a dev dependency to any of the package managers (NPM, Yarn, PNPM)

Supports Vite >=3 and Node >=14

npm install vite-plugin-image-optimizer --save-dev

Warning

sharp and svgo don't come installed as part of the package. You will have to install them manually and add it as a dev dependency. This is a design decision so you can choose to skip installing sharp if you only want to optimize svg assets using svgo and vice versa.

npm install sharp --save-dev
npm install svgo --save-dev

Usage

import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
import { defineConfig } from 'vite';

export default defineConfig(() => {
  return {
    plugins: [
      ViteImageOptimizer({
        /* pass your config */
      }),
    ],
  };
});

Default Configuration

The default configuration is made for lossless compression of image assets.

const DEFAULT_OPTIONS = {
  logStats: true,
  ansiColors: true,
  test: /\.(jpe?g|png|gif|tiff|webp|svg|avif)$/i,
  exclude: undefined,
  include: undefined,
  includePublic: true,
  svg: {
    multipass: true,
    plugins: [
      {
        name: 'preset-default',
        params: {
          overrides: {
            cleanupNumericValues: false,
            cleanupIds: {
              minify: false,
              remove: false,
            },
            convertPathData: false,
          },
        },
      },
      'sortAttrs',
      {
        name: 'addAttributesToSVGElement',
        params: {
          attributes: [{ xmlns: 'http://www.w3.org/2000/svg' }],
        },
      },
    ],
  },
  png: {
    // https://sharp.pixelplumbing.com/api-output#png
    quality: 100,
  },
  jpeg: {
    // https://sharp.pixelplumbing.com/api-output#jpeg
    quality: 100,
  },
  jpg: {
    // https://sharp.pixelplumbing.com/api-output#jpeg
    quality: 100,
  },
  tiff: {
    // https://sharp.pixelplumbing.com/api-output#tiff
    quality: 100,
  },
  // gif does not support lossless compression
  // https://sharp.pixelplumbing.com/api-output#gif
  gif: {},
  webp: {
    // https://sharp.pixelplumbing.com/api-output#webp
    lossless: true,
  },
  avif: {
    // https://sharp.pixelplumbing.com/api-output#avif
    lossless: true,
  },
  cache: false,
  cacheLocation: undefined,
};

Plugin Options

test

Type: RegExp

Default: /\.(jpe?g|png|gif|tiff|webp|svg|avif)$/i

Test to match files against.

exclude

Type: String | RegExp | Array<string>

Default: undefined

Files to exclude. RegExp can be used on the source path to exclude a particular folder (exclude: /textures/).

include

Type: String | RegExp | Array<string>

Default: undefined

Files to include. RegExp can be used on the source path to include a particular folder (include: /textures/).

Warning

This will override any options set in test and exclude and has a higher preference. Use this option if you want to include specific assets only.

includePublic

Type: boolean

Default: true…

Description from the npm listing.

  • vite
  • vite-plugin
  • image compression
  • image optimization
  • svgo
  • sharp.js

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-image-optimizer weekly downloads on npm, last 90 days: 364,131 weekly downloads as of Dec 5, 2026, +50.6% over 90 days.vite-plugin-image-optimizerWeekly downloads on npm · Last 90 days364,131downloads / week+50.6% over 90 days0100K200K300K400KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vite-plugin-image-optimizer weekly downloads on npm, last 90 days: 364,131 weekly downloads as of Dec 5, 2026, +50.6% over 90 days.

7/30/90-day growth

vite-plugin-image-optimizer weekly downloads growth on npm: +11.5% over 7 days, -2.5% over 30 days, +50.6% over 90 days.vite-plugin-image-optimizerWeekly downloads growth on npm364,131downloads / week now7-day growth+37,446 weekly downloads+11.5%30-day growth-9,466 weekly downloads-2.5%90-day growth+122,342 weekly downloads+50.6%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-image-optimizer weekly downloads growth on npm: +11.5% over 7 days, -2.5% over 30 days, +50.6% over 90 days.

Ranking history

vite-plugin-image-optimizer npm ranking history: currently #438 (by weekly downloads).vite-plugin-image-optimizernpm ranking · by weekly downloads · Last 90 days#438current rank#415#420#425#430#435#440#445Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-image-optimizer npm ranking history: currently #438 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 22, #18 (overall #438)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 4, #4 (overall #64)
Vite plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for vite-plugin-image-optimizer
Date (UTC)Weekly downloadsChange vs. previous
364,131-3.4K
367,564+17.2K
350,358+15.1K
335,260+4.7K
330,520+5.4K
325,074-995
326,069-616
326,685+98
326,587-17.4K
343,948-19.4K
363,340-14.3K
377,619-5.1K
382,691-2.2K
384,904—

Similar npm Vite plugins plugins

All 20 vite-plugin-image-optimizer alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-image-optimizer. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.