{"id":22168,"library":"rollup-plugin-postcss-umi","title":"rollup-plugin-postcss-umi","description":"Seamlessly integrates PostCSS with Rollup. Version 2.0.3 supports Rollup 1.0+ and processes CSS, SASS, Stylus, and Less files. It injects CSS into <head> by default, supports CSS modules, and can extract CSS to file. Differentiators include local PostCSS config auto-detection and node_modules resolution for Sass imports. Released with monthly cadence, maintained by egoist. ESM-only import.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/egoist/rollup-plugin-postcss-umi","tags":["javascript","postcss","rollup"],"install":[{"cmd":"npm install rollup-plugin-postcss-umi","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-postcss-umi","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-postcss-umi","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for CSS processing.","package":"postcss","optional":false},{"reason":"Peer dependency; plugin works only with Rollup 1.0+.","package":"rollup","optional":false}],"imports":[{"note":"Package is ESM-only from v2; CommonJS require will fail.","wrong":"const postcss = require('rollup-plugin-postcss-umi')","symbol":"postcss","correct":"import postcss from 'rollup-plugin-postcss-umi'"},{"note":"If using require() in legacy setups, access .default property.","wrong":"const postcss = require('rollup-plugin-postcss-umi')","symbol":"postcss (CJS usage)","correct":"const postcss = require('rollup-plugin-postcss-umi').default"},{"note":"TypeScript users should use default import; types are included.","wrong":"import postcss = require('rollup-plugin-postcss-umi')","symbol":"TypeScript types","correct":"import postcss from 'rollup-plugin-postcss-umi'"}],"quickstart":{"code":"// rollup.config.js\nimport postcss from 'rollup-plugin-postcss-umi';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'cjs'\n  },\n  plugins: [\n    postcss({\n      plugins: [],\n      // Enable CSS modules for .module.css files\n      autoModules: true,\n      // Extract CSS to separate file\n      extract: true\n    })\n  ]\n};","lang":"javascript","description":"Basic Rollup config integrating PostCSS with extraction and CSS modules auto-detection."},"warnings":[{"fix":"Upgrade Rollup to 1.0+.","message":"v2.0 drops support for Rollup 0.x; only Rollup 1.0 and above are supported.","severity":"breaking","affected_versions":">=2.0"},{"fix":"If you need both injection and extraction, handle manually or use a separate plugin.","message":"When extract: true, CSS is not injected into <head>; inject option is forced to false.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Supply a custom namedExports function to control naming.","message":"Named exports for CSS modules use a transformation that replaces dashes with $ wrapped underscores, which may cause unexpected export names.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use the official rollup-plugin-postcss package if compatibility with other tools is preferred.","message":"The package name includes 'umi' but has no direct relation to UmiJS; consider using rollup-plugin-postcss for clarity.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import statement or require with .default: const postcss = require('rollup-plugin-postcss-umi').default","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'rollup-plugin-postcss-umi'"},{"fix":"Ensure you call postcss({...}) not just postcss, and pass as a plugin in an array.","cause":"Importing package but mistakenly treating it as a default export when it is an object, or using wrong rollup config format.","error":"TypeError: postcss is not a function"},{"fix":"Run npm install postcss --dev beside rollup-plugin-postcss-umi.","cause":"PostCSS is a peer dependency and not automatically installed.","error":"Error: The 'postcss' plugin is not found. Did you install 'postcss'?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}