Registry / devops / image-minimizer-webpack-plugin

image-minimizer-webpack-plugin

JSON →
library5.0.0jsnpmunverified

Webpack loader and plugin to optimize (compress) images using imagemin, sharp, or svgo. Current stable version is 5.0.0 (released 2026-03-03), with a release cadence of major versions approximately yearly. It supports multiple backends for image optimization: imagemin (traditional), sharp (high-performance), svgo (for SVGs), and the deprecated squoosh. Key differentiators include integration as both a loader and plugin, support for generation of alternative formats (webp, avif), and filtering per minimizer. It has shipped TypeScript types and requires Node.js >=20.9.0 and webpack ^5.1.0.

npm install image-minimizer-webpack-plugin
INSTALL
IMPORT
SIG · IMAGE-MINIMIZER-WE
I
image-minimizer-webpack-plugin
devopsjavascriptv5.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ImageMinimizerPlugin
import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin'
const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin')
Default export is the plugin class. CommonJS require works in Node.js, but ESM is preferred.
imageminNormalizeConfig
import { imageminNormalizeConfig } from 'image-minimizer-webpack-plugin'
Named export available since v4; used to normalize config for custom integrations.
type ImageMinimizerPluginOptions
import type { ImageMinimizerPluginOptions } from 'image-minimizer-webpack-plugin'
Type import for TypeScript users; requires named export.

Basic webpack config with ImageMinimizerPlugin using imagemin and jpegtran/optipng plugins.

const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin'); // webpack.config.js module.exports = { module: { rules: [ { test: /\.(jpe?g|png|gif|svg)$/i, type: 'asset', }, ], }, plugins: [ new ImageMinimizerPlugin({ minimizer: { implementation: ImageMinimizerPlugin.imageminMinify, options: { plugins: [ ['jpegtran', { progressive: true }], ['optipng', { optimizationLevel: 5 }], ], }, }, }), ], };
Debug
Known issues
breakingMinimum supported Node.js version is 20.9.0.
fix
Upgrade Node.js to >=20.9.0 or stay on v4.x.
affects: >=5.0.0
breakingMinimum supported Node.js version is 18.12.0.
fix
Upgrade Node.js to >=18.12.0 or stay on v3.x.
affects: >=4.0.0 <5.0.0
deprecatedsquoosh optimizer has been deprecated.
fix
Use sharp or imagemin instead.
affects: >=4.0.0
gotchaConcurrency default value changed to avoid CPU overload; may affect performance tuning.
fix
Explicitly set concurrency if defaults are not optimal.
affects: >=4.1.4
gotchaWhen using filesystem cache, plugin may crash if cache is corrupted.
fix
Upgrade to >=4.1.4 or clear cache.
affects: >=4.1.1 <4.1.4
Errors
Common errors & fixes
Error: Cannot find module 'imagemin'
imagemin or its plugins are not installed.
fix
npm install imagemin imagemin-jpegtran imagemin-optipng (or other plugins)
TypeError: ImageMinimizerPlugin is not a constructor
Using default import incorrectly (e.g., import * as IM from '...') or using wrong require.
fix
Use default import: import ImageMinimizerPlugin from 'image-minimizer-webpack-plugin'
ValidationError: Invalid options object. Options should be an object.
Passing minimizer or generator options incorrectly (e.g., array instead of object).
fix
Ensure minimizer is an object with implementation and options keys.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency: requires webpack ^5.1.0
Agent activity
7 hits · last 30 days
node
6
Perplexity
1
Resources
image-minimizer-webpack-plugin — npm install image-minimizer-webpack-plugin · libregistry