rollup-plugin-postcss-independent

raw JSON →
1.8.1 verified Mon Apr 27 auth: no javascript

Rollup plugin for PostCSS integration, adapted for global NPM packages (v1.8.1, active development). Based on rollup-plugin-postcss, it resolves issues with importCwd and global installations. Key differentiator: compatible with globally installed npm packages where peer dependencies may be missing. Uses async await and supports CSS modules, inject, and minimize options.

error Error: Could not resolve a postcss module. Please install it with 'npm i postcss --save-dev'.
cause PostCSS not installed locally.
fix
Run 'npm install postcss --save-dev'.
gotcha The plugin expects PostCSS to be installed as a local dependency; if installed globally, it might fail if peer deps are missing.
fix Ensure PostCSS is listed as a local devDependency.
breaking In v1.7.0, the internal importCwd dependency was removed; existing configurations that relied on global PostCSS resolution may break.
fix Install PostCSS locally as a devDependency if using global installs.
npm install rollup-plugin-postcss-independed
yarn add rollup-plugin-postcss-independed
pnpm add rollup-plugin-postcss-independed

Rollup configuration using postcss plugin with modules, injection, and minification enabled.

import postcss from 'rollup-plugin-postcss-independent';

export default {
  input: 'src/main.js',
  output: { file: 'dist/bundle.js', format: 'esm' },
  plugins: [
    postcss({
      modules: true,
      inject: true,
      minimize: true,
      extract: false
    })
  ]
};