{"id":21975,"library":"rollup-plugin-css-module","title":"rollup-plugin-css-module","description":"A Rollup plugin for handling CSS Modules with PostCSS. Current stable version is 0.0.25, released with limited update cadence (sporadic). It provides basic CSS Modules support in Rollup bundles by leveraging PostCSS for transformation. Compared to alternatives like rollup-plugin-postcss, this plugin is lighter but less maintained, with fewer configuration options and no built-in CSS extraction. Suitable for simple projects that need CSS Modules without extra features.","status":"active","version":"0.0.25","language":"javascript","source_language":"en","source_url":"https://github.com/paul-veevers/rollup-plugin-css-module","tags":["javascript","rollup","rollup-plugin","css module","postcss"],"install":[{"cmd":"npm install rollup-plugin-css-module","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-css-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-css-module","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for CSS transformation; not automatically installed.","package":"postcss","optional":true}],"imports":[{"note":"Plugin uses default export. CJS require works but ESM preferred.","wrong":"const cssModule = require('rollup-plugin-css-module')","symbol":"cssModule","correct":"import cssModule from 'rollup-plugin-css-module'"},{"note":"Named import does not exist; use default import.","wrong":"import { cssModule } from 'rollup-plugin-css-module'","symbol":"default export","correct":"import cssModule from 'rollup-plugin-css-module'"},{"note":"Plugin is a function, not an object with methods.","wrong":"cssModule.insert({ insert: true })","symbol":"Plugin (with config)","correct":"cssModule({ insert: true })"}],"quickstart":{"code":"import cssModule from 'rollup-plugin-css-module';\nimport resolve from '@rollup/plugin-node-resolve';\nimport commonjs from '@rollup/plugin-commonjs';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    cssModule({\n      include: '**/*.css',\n      exclude: '**/global.css',\n      insert: true\n    }),\n    resolve(),\n    commonjs()\n  ]\n};","lang":"javascript","description":"Shows basic Rollup config with css-module plugin, using include/exclude patterns and insert mode."},"warnings":[{"fix":"Set insert: true explicitly or inline CSS via other means.","message":"The `insert` option defaults to true but may be deprecated in future; prefer explicit setting.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Add include/exclude patterns matching your CSS file names.","message":"Plugin does not automatically include/exclude files; must specify `include` and `exclude` patterns.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Disable CSS modules in rollup-plugin-postcss if both are used.","message":"When using together with rollup-plugin-postcss, order may cause conflicts. Only one CSS plugin should handle modules.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install postcss --save-dev","cause":"PostCSS is not installed, but it's a peer dependency.","error":"Error: Cannot find module 'postcss'"},{"fix":"Use `import cssModule from 'rollup-plugin-css-module'`","cause":"Using named import instead of default import.","error":"TypeError: cssModule is not a function"},{"fix":"Ensure plugin is in plugins array and include pattern matches your CSS.","cause":"Plugin not included or not matching the CSS files.","error":"Error: Unexpected behavior with CSS modules (class names not transformed)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}