An ESBuild plugin (v0.0.4) for handling CSS/SCSS modules with autoprefixer, treeshakable CSS, and full TypeScript support. It automatically converts CSS/SCSS modules to BEM-like scoped names without hashes by default for easier library CSS overrides. Unlike similar plugins, it is designed specifically for React 18 server components and supports treeshakable imports (e.g., import from 'esbuild-plugin-react18-css/client/component'). Release cadence is low (4 releases in early 2024); the project is maintained but still in early development (0.x). Requires esbuild as a peer dependency.
npm install esbuild-plugin-react18-cssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic integration of esbuild-plugin-react18-css with esbuild, including plugin options for scoped class names and autoprefixer.
Set generateScopedName to include a hash, e.g., '[name]__[local]___[hash:base64:5]'.
Use a separate postcss plugin with autoprefixer for more control.
Use import syntax or set up your project for ESM.
Use import type { CSSPluginOptions } from 'esbuild-plugin-react18-css'.Filter out node_modules in the plugin's setup function manually.
npm install esbuild-plugin-react18-css --save-dev
Ensure cssPlugin() is called with an object or no arguments: cssPlugin({}) or cssPlugin().Switch to ESM (type: 'module' in package.json) or use dynamic import: await import('esbuild-plugin-react18-css').Use import type { CSSPluginOptions } from 'esbuild-plugin-react18-css'.