Webpack plugin that minifies CSS using cssnano, with optional support for csso, clean-css, esbuild, and swc. Current stable version is 8.0.0, released 2026-03-02, requiring Node.js >= 20.9.0 and Webpack ^5. Unlike optimize-css-assets-webpack-plugin, it offers better source map handling, caching, and parallel processing via worker threads. Release cadence is roughly annual with patch releases for bug fixes. Ships TypeScript types.
npm install css-minimizer-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Basic webpack configuration integrating CssMinimizerPlugin with MiniCssExtractPlugin for CSS minification in production.
Upgrade Node.js to version >= 20.9.0.
Upgrade Node.js to version >= 18.12.0.
Review cssnano v7 migration guide: https://github.com/cssnano/cssnano/releases/tag/cssnano%406.0.0
Review cssnano v6 migration guide: https://github.com/cssnano/cssnano/releases/tag/cssnano%406.0.0
Set devtool to one of the supported values (e.g., 'source-map').
Use default import: import CssMinimizerPlugin from 'css-minimizer-webpack-plugin' or const CssMinimizerPlugin = require('css-minimizer-webpack-plugin').defaultRun 'npm install --save-dev css-minimizer-webpack-plugin'
Ensure Webpack >= 5 is installed and compatible plugin version.