An ESBuild plugin for handling CSS modules with support for PostCSS and postcss-modules. The current stable version is 0.1.1, released in 2024. It addresses style loss issues when bundling multiple components, a known problem in esbuild-plugin-react18-css. Key differentiators include seamless integration with ESBuild, automatic scoping via CSS modules, and dependency on hash-css-selector for unique class name generation. The plugin requires peer dependencies (hash-css-selector, postcss, postcss-modules). It is part of the Tencent/hel ecosystem and is actively maintained.
npm install esbuild-plugin-module-cssNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use the plugin with ESBuild to process CSS modules. Includes optional postcssPlugins and cssModulesOptions.
Install peer dependencies: npm install hash-css-selector postcss postcss-modules
Set a custom hash seed via the 'hashSeed' option in the plugin's config.
Check changelog and migrate to new configuration structure when available.
Run npm install hash-css-selector
Ensure postcss is installed and configure postcssPlugins if needed.
Upgrade postcss to version 8 or higher.