An esbuild plugin for bundling CSS Module files with support for both client-side and server-side rendering (SSR). Version 0.1.32 provides a straightforward way to generate CSS class name maps for server-side use while keeping class-scoped styles for client bundles. It integrates directly into esbuild's build pipeline and is part of the Goldstack monorepo, receiving updates as part of that project. Compared to alternatives like esbuild-css-modules-plugin, it is designed specifically for SSR workflows, automatically producing both CSS and JavaScript mapping files. The plugin has no direct runtime dependencies besides esbuild (peer dependency ^0.25.6), and its source is on GitHub within the Goldstack repository.
npm install esbuild-ssr-css-modules-pluginNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Uses esbuild with the SSR CSS Modules plugin to bundle an app while extracting CSS module mappings for server use.
Rename your CSS module files to follow the .module.css or .module.scss naming convention.
Replace `outdir` with `outputDir` in plugin options.
Explicitly set the 'naming' option to '[name].module' if you need the old naming pattern.
Ensure your project has esbuild at version ^0.25.6 installed.
Create a new plugin instance inside each esbuild.build call, not as a shared singleton.
Change your script to a module (set `"type": "module"` in package.json) and use `import esbuildSsrCssModulesPlugin from 'esbuild-ssr-css-modules-plugin'`.
Replace `outdir: './path'` with `outputDir: './path'`.
Ensure your entry point imports CSS module files with the `.module.css` extension, or adjust the plugin's `filter` option to match your file names.