rollup-plugin-thunder

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

A Rollup plugin for LightningCSS, providing CSS transformation, minification, and module support. Current stable version 2.0.1 (September 2025) with regular updates. Key differentiators: seamless integration with Rollup, auto CSS modules via naming conventions, and support for CSSStyleSheet. ESM-only, TypeScript-friendly with bundled types.

error Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
cause Using CommonJS require() to import an ESM-only package.
fix
Use dynamic import: const thunder = await import('rollup-plugin-thunder');
error Module '"rollup-plugin-thunder"' has no exported member 'classes'.
cause Named export 'classes' was renamed to 'clasess' in v2.0.0.
fix
Use 'clasess' or 'C' instead of 'classes'.
error TypeError: thunder is not a function
cause Default import used as function but imported as named export.
fix
Use default import: import thunder from 'rollup-plugin-thunder'
breaking Export class list as `clasess` and shorthand `C` named export. Previous `classes` export removed.
fix Change imports to use 'clasess' or 'C' instead of 'classes'.
deprecated Options may change in future minor versions without major semver bump.
fix Pin exact version and review changelog for option changes.
gotcha The 'clasess' export name is intentionally misspelled. Expect typos in user code.
fix Use correct spelling 'clasess' or shorthand 'C'.
gotcha Plugin is ESM-only. CommonJS require() throws error.
fix Use dynamic import or ensure project is ESM.
gotcha CSS modules auto-detection may conflict with other CSS plugins (e.g., postcss).
fix Disable 'autoModules' or customize regex to avoid overlap.
npm install rollup-plugin-thunder
yarn add rollup-plugin-thunder
pnpm add rollup-plugin-thunder

Configures Rollup with Thunder plugin for CSS processing: minification, source maps, CSS modules, and auto-module detection.

import thunder from 'rollup-plugin-thunder';

export default {
  input: 'src/index.css',
  plugins: [
    thunder({
      minify: true,
      sourceMap: true,
      modules: true,
      autoModules: /\\.module\\.css$/,
    }),
  ],
  output: {
    dir: 'dist',
    format: 'esm',
  },
};