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.
Common errors
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'
Warnings
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.
Install
npm install rollup-plugin-thunder yarn add rollup-plugin-thunder pnpm add rollup-plugin-thunder Imports
- thunder wrong
const thunder = require('rollup-plugin-thunder')correctimport thunder from 'rollup-plugin-thunder' - clasess wrong
import { classes } from 'rollup-plugin-thunder'correctimport { clasess } from 'rollup-plugin-thunder' - C
import { C } from 'rollup-plugin-thunder' - type Options wrong
import { Options } from 'rollup-plugin-thunder'correctimport type { Options } from 'rollup-plugin-thunder'
Quickstart
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',
},
};