{"id":22162,"library":"rollup-plugin-postcss-config","title":"rollup-plugin-postcss-config","description":"Transform PostCSS in Rollup using options from a postcss config file (postcss.config.js). v2.0.0 is the latest stable release, last published in 2018. It relies on postcss-load-config to read config files and makes no assumptions about CSS output, requiring a separate plugin (e.g., rollup-plugin-string) to handle the transformed CSS. Key differentiators: minimal integration that delegates plugin configuration to standard PostCSS config files, unlike alternatives like rollup-plugin-postcss which bundle plugins internally. Breaking change in v2.0.0: uses object spread syntax, requiring Node >=8.6.0. No further updates expected.","status":"maintenance","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/Updater/rollup-plugin-postcss-config","tags":["javascript","rollup","rollup-plugin","postcss"],"install":[{"cmd":"npm install rollup-plugin-postcss-config","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-postcss-config","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-postcss-config","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin functionality","package":"rollup","optional":false},{"reason":"loads PostCSS config file","package":"postcss-load-config","optional":false}],"imports":[{"note":"ESM-only; CommonJS require will fail. For CommonJS projects, use dynamic import or transpile.","wrong":"const postcss = require('rollup-plugin-postcss-config')","symbol":"default","correct":"import postcss from 'rollup-plugin-postcss-config'"},{"note":"No named export exists; default import is the only way. This is a common mistake.","wrong":"import { default as postcss } from 'rollup-plugin-postcss-config'","symbol":"postcss (named)","correct":"import { postcss } from 'rollup-plugin-postcss-config'"},{"note":"No type definitions included; use @types/rollup-plugin-postcss-config if available, or declare module.","wrong":"","symbol":"TypeScript type","correct":"import postcss from 'rollup-plugin-postcss-config'"}],"quickstart":{"code":"// postcss.config.js\nmodule.exports = {\n  plugins: {\n    'postcss-import': {},\n    'postcss-cssnext': {},\n    'postcss-reporter': {},\n  },\n};\n\n// rollup.config.js\nimport postcss from 'rollup-plugin-postcss-config';\nimport string from 'rollup-plugin-string';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife',\n    name: 'MyBundle',\n  },\n  plugins: [\n    postcss({\n      include: '*.css',\n      exclude: 'node_modules/**',\n    }),\n    string({\n      include: '*.css',\n      exclude: 'node_modules/**',\n    }),\n  ],\n};","lang":"javascript","description":"Configure PostCSS via postcss.config.js and use rollup-plugin-postcss-config with a string plugin to output CSS as a string."},"warnings":[{"fix":"Upgrade Node to version >=8.6.0 or avoid using spread syntax if you must stay on older Node.","message":"v2.0.0 uses object spread syntax, requiring Node >=8.6.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Add a subsequent plugin in the plugins array that includes the same CSS files, e.g., `string({ include: '*.css' })`.","message":"The plugin does not output CSS files or inject styles; it only transforms CSS code. You must chain another plugin (e.g., rollup-plugin-string, rollup-plugin-css-only) to handle the output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check compatibility with your Rollup version; consider using rollup-plugin-postcss or rollup-plugin-postcss-lit as alternatives.","message":"Package has not been updated since 2018. It may not work with modern Rollup versions (>=3).","severity":"deprecated","affected_versions":">=2.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 postcss from 'rollup-plugin-postcss-config'` in an ES module context, or use dynamic import: `const postcss = (await import('rollup-plugin-postcss-config')).default`.","cause":"This package is ESM-only and cannot be required with CommonJS.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Ensure a valid `postcss.config.js` exists in the project root with a `plugins` object/array.","cause":"postcss.config.js not found or malformed config.","error":"TypeError: Cannot use 'in' operator to search for 'plugins' in undefined"},{"fix":"Create a `postcss.config.js` file in the project root, or specify a custom `config` path in plugin options (not supported by this version).","cause":"postcss-load-config cannot find the config file.","error":"Error: Could not load /path/to/postcss.config.js (imported by rollup-plugin-postcss-config): ENOENT"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}