{"id":26866,"library":"csso-webpack-plugin","title":"CSSO Webpack Plugin","description":"Webpack plugin for CSSO minification that processes CSS bundles to reduce size. Current stable is v2.0.0-beta.3, with v3.0.0 published but ships CSSO 5.x (breaking). Releases are irregular. Differentiators: supports full restructuring across chunks, works with CSS Modules custom syntax, can output both pure and minified versions simultaneously via pluginOutputPostfix. Alternative to csso-loader or postcss-csso.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/zoobestik/csso-webpack-plugin","tags":["javascript","css","minify","csso","webpack","optimisation","typescript"],"install":[{"cmd":"npm install csso-webpack-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add csso-webpack-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add csso-webpack-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CSS minimizer engine","package":"csso","optional":false}],"imports":[{"note":"CommonJS require returns the plugin as the default export; use .default if using CJS with ES module interop.","wrong":"const CssoWebpackPlugin = require('csso-webpack-plugin')","symbol":"default","correct":"import CssoWebpackPlugin from 'csso-webpack-plugin'"},{"note":"CommonJS require returns the module object, the plugin is on .default. In ESM, default import works directly.","wrong":"const CssoWebpackPlugin = require('csso-webpack-plugin')","symbol":"CssoWebpackPlugin","correct":"const CssoWebpackPlugin = require('csso-webpack-plugin').default"},{"note":"CssoOptions is a TypeScript type/interface, not a runtime value.","wrong":"import { CssoOptions } from 'csso-webpack-plugin'","symbol":"CssoOptions","correct":"import type { CssoOptions } from 'csso-webpack-plugin'"}],"quickstart":{"code":"import CssoWebpackPlugin from 'csso-webpack-plugin';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\n\nconst config = {\n  entry: './src/index.js',\n  output: { filename: 'bundle.js' },\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        use: [MiniCssExtractPlugin.loader, 'css-loader']\n      }\n    ]\n  },\n  plugins: [\n    new MiniCssExtractPlugin({ filename: '[name].css' }),\n    new CssoWebpackPlugin()\n  ]\n};\n\nexport default config;","lang":"typescript","description":"Basic webpack config using MiniCssExtractPlugin and CssoWebpackPlugin to minify CSS output."},"warnings":[{"fix":"Use v2.x for Node <10 or CSSO 4.x compatibility.","message":"Version 3.0.0 requires Node.js >=10 and CSSO 5.x, which may produce different output than CSSO 4.x.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use v1.x for Node <8.","message":"In v2.0.0, the plugin switched to async/await, dropping support for Node <8.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Remove sourceMap option and set devtool in webpack config.","message":"options.sourceMap is deprecated since v1.0.0-beta.8; use webpack devtool instead.","severity":"deprecated","affected_versions":">=1.0.0-beta.8"},{"fix":"Use require('csso-webpack-plugin').default or enable esModuleInterop.","message":"With CJS require, the plugin is on .default, not the returned object directly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ignore .flow files; TypeScript types are bundled.","message":"The package ships Flow types in lib/index.js.flow but this may cause confusion for TypeScript users.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to: const CssoWebpackPlugin = require('csso-webpack-plugin').default;","cause":"Using CommonJS require without accessing .default export.","error":"TypeError: CssoWebpackPlugin is not a constructor"},{"fix":"Run: npm install --save-dev csso-webpack-plugin","cause":"Missing installation or wrong package name.","error":"Error: Cannot find module 'csso-webpack-plugin'"},{"fix":"Add a rule for .css files using css-loader and MiniCssExtractPlugin.loader.","cause":"CSS not processed by css-loader before plugin.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}