Registry /
devops / minimizer-webpack-plugin
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MinimizerPlugin
✓ import MinimizerPlugin from 'minimizer-webpack-plugin'
✗ const { MinimizerPlugin } = require('minimizer-webpack-plugin')
Default export is the plugin class. Named export also available for TypeScript type imports.
terserMinify
✓ import MinimizerPlugin from 'minimizer-webpack-plugin';
MinimizerPlugin.terserMinify
✗ import { terserMinify } from 'minimizer-webpack-plugin'
Minifier functions are static properties on the class, not named exports.
swcMinify
✓ import MinimizerPlugin from 'minimizer-webpack-plugin';
MinimizerPlugin.swcMinify
Requires @swc/core installed.
Shows basic usage with two MinimizerPlugin instances: one for JS using terser, one for CSS using cssnano.
// webpack.config.js
const MinimizerPlugin = require('minimizer-webpack-plugin');
module.exports = {
// ... other webpack config
optimization: {
minimize: true,
minimizer: [
new MinimizerPlugin({
test: /\.js$/i,
minify: MinimizerPlugin.terserMinify
}),
new MinimizerPlugin({
test: /\.css$/i,
minify: MinimizerPlugin.cssnanoMinify
})
]
}
};
Errors
Common errors & fixes
Error: Minifier not found. Did you install the required dependency?
Using a minifier without installing its optional peer dependency.
fixInstall the required package, e.g. npm install --save-dev @swc/core for swcMinify.
TypeError: MinimizerPlugin is not a constructor
Importing as named export instead of default export.
fixUse import MinimizerPlugin from 'minimizer-webpack-plugin'.
Configuration error: Please provide a valid 'minify' option
No minify option provided or invalid value.
fixSet minify: MinimizerPlugin.terserMinify (or other static property).
Audit
Dependencies
webpackrequiredpeer dependency: webpack 5.x required
uglify-jsoptionaloptional: needed only if using uglify-js minifier
@swc/coreoptionaloptional: needed only if using swc minifier
esbuildoptionaloptional: needed only if using esbuild minifier
cssnanooptionaloptional: needed only if using cssnano CSS minifier
postcssoptionalrequired by cssnano
@swc/htmloptionaloptional: needed only if using swc HTML minifier
@minify-html/nodeoptionaloptional: needed only if using minify-html HTML minifier
cssooptionaloptional: needed only if using csso CSS minifier
clean-cssoptionaloptional: needed only if using clean-css CSS minifier
lightningcssoptionaloptional: needed only if using lightningcss CSS minifier
@swc/cssoptionaloptional: needed only if using swc CSS minifier
html-minifier-terseroptionaloptional: needed only if using html-minifier-terser HTML minifier