npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-omni-compress

v1.0.0

Published

Vite plugin to compress image and audio assets at build time using omni-compress

Readme

vite-plugin-omni-compress

npm license

Compress image and audio assets at build time using omni-compress.

Vite has no built-in image/audio optimization — this plugin fills that gap.

API Docs · Playground · GitHub

Install

npm install --save-dev vite-plugin-omni-compress omni-compress

Usage

// vite.config.ts
import { defineConfig } from 'vite';
import { omniCompress } from 'vite-plugin-omni-compress';

export default defineConfig({
  plugins: [
    omniCompress({
      images: { format: 'webp', quality: 0.8 },
      audio: { format: 'opus', bitrate: '96k' },
    }),
  ],
});

Options

omniCompress({
  // Image compression — set to false to disable
  images: {
    format: 'webp', // 'webp' | 'jpeg' | 'png' | 'avif' (default: 'webp')
    quality: 0.8, // 0–1 (default: 0.8)
    maxWidth: 1920, // optional
    maxHeight: 1080, // optional
    strict: true, // return original if compressed is larger (default: true)
  },

  // Audio compression — set to false to disable
  audio: {
    format: 'opus', // 'opus' | 'mp3' | 'aac' | 'flac' (default: 'opus')
    bitrate: '96k', // (default: '96k')
  },

  // Glob patterns to include (matched against filenames)
  include: ['**/*.{png,jpg,jpeg,wav,mp3}'],

  // Glob patterns to exclude
  exclude: ['**/node_modules/**'],

  // Print compression stats to terminal (default: true)
  verbose: true,
});

Example output

[vite-plugin-omni-compress]
  assets/hero.png → assets/hero.webp — 245 KB → 38 KB (-85%) [webp]
  assets/intro.wav → assets/intro.ogg — 8.2 MB → 680 KB (-92%) [opus]
  Total: 7.7 MB saved (-91%) across 2 files

Notes

  • Runs in the closeBundle hook — after Vite finishes building, before the process exits.
  • Uses the Node.js path of omni-compress (native ffmpeg binary). Requires ffmpeg on PATH or ffmpeg-static installed.
  • Files are replaced in-place in the output directory. The original file is deleted if the extension changes (e.g. .png → .webp).
  • If compression yields a larger file, the original is kept unchanged (strict: true).

License

MIT