{"id":22163,"library":"rollup-plugin-postcss-export","title":"rollup-plugin-postcss-export","description":"A Rollup plugin that integrates PostCSS processing and bundles processed CSS into a single external file. Version 1.0.3 is the latest stable release. Features include custom PostCSS plugins, source maps, CSS modules support via postcss-modules, and configurable file extensions. Key differentiators: it exports all CSS to one external file rather than inlining or emitting separate chunks, and it supports CSS modules with a getExport callback. The plugin is lightweight and focused, but has low maintenance activity.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/lmihaidaniel/rollup-plugin-postcss-export","tags":["javascript","postcss","rollup","export"],"install":[{"cmd":"npm install rollup-plugin-postcss-export","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-postcss-export","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-postcss-export","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; default export.","wrong":"const postcss = require('rollup-plugin-postcss-export');","symbol":"postcss","correct":"import postcss from 'rollup-plugin-postcss-export'"},{"note":"Do not use named import; plugin is default-exported.","wrong":"import { postcss } from 'rollup-plugin-postcss-export'","symbol":"postcss (default)","correct":"import postcss from 'rollup-plugin-postcss-export'"},{"note":"Type imports are available; avoid runtime import of types.","wrong":"import { PostCSSPluginOptions } from 'rollup-plugin-postcss-export'","symbol":"TypeScript type","correct":"import type { PostCSSPluginOptions } from 'rollup-plugin-postcss-export'"}],"quickstart":{"code":"import postcss from 'rollup-plugin-postcss-export';\n\nexport default {\n  input: 'src/main.js',\n  output: { dir: 'dist', format: 'es' },\n  plugins: [\n    postcss({\n      plugins: [require('autoprefixer')],\n      sourceMap: true,\n      export: './dist/bundle.css',\n    }),\n  ],\n};","lang":"javascript","description":"Minimal Rollup config using rollup-plugin-postcss-export to process CSS and export a single external CSS file with autoprefixer and source maps."},"warnings":[{"fix":"Use './output.css' instead of '/absolute/path/output.css'.","message":"The 'export' option must be a path relative to Rollup's output directory, not an absolute path. Misconfigured paths lead to missing CSS output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all CSS is imported in your JS entry points or use additional plugins for HTML.","message":"The plugin only processes CSS imported via JavaScript (import 'style.css'). It does not include CSS from <link> tags or HTML files.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace 'postcss: require('postcss')' with 'plugins: [...]'.","message":"The 'postcss' option to pass a PostCSS instance directly is deprecated. Use the 'plugins' array instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Implement 'getJSON' in postcss-modules config and a 'getExport' function in the plugin options.","message":"CSS modules (via postcss-modules) require manual export mapping; the plugin does not handle it automatically.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use alternative plugins like rollup-plugin-postcss if you need to inject CSS or bundle inline.","message":"The plugin does not support 'use' or 'inject' options; all CSS is exported to an external file only.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to 'import postcss from 'rollup-plugin-postcss-export'","cause":"Incorrect import: using named import instead of default.","error":"TypeError: postcss is not a function"},{"fix":"Run 'npm install rollup-plugin-postcss-export' and ensure no typos.","cause":"Missing npm dependencies or incorrect package name.","error":"Error: Cannot find module 'rollup-plugin-postcss-export'"},{"fix":"Add 'export: './bundle.css'' to the postcss options.","cause":"Missing 'export' option in plugin config.","error":"Error: The 'export' option is required if you want to output a file."},{"fix":"Ensure plugin is early in the plugins array and imports have correct paths.","cause":"CSS import not resolved or plugin not applied before other plugins.","error":"TypeError: Cannot read property 'id' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}