A style loader plugin for esbuild that supports CSS, SCSS, LESS, Stylus, and CSS Modules. Current stable version is 0.3.4. It uses lightningcss for fast CSS processing and includes autoprefixer with sensible defaults (ios >= 11, android >= 5, chrome >= 54). Unlike other esbuild CSS plugins, it offers zero-config setup, built-in CSS Modules support for files matching .module.css or ?modules query, and handles multiple preprocessors via built-in loaders (LESS built-in, sass via peer dep). Released under MIT license with TypeScript types included.
npm install esbuild-style-loaderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up esbuild with the style loader plugin, bundling CSS imports from app.js and outputting to dist/
Switch to ESM imports: import { styleLoader } from 'esbuild-style-loader'Use cssModules: { pattern: '[local]__[hash]' } instead of cssModules: trueRename file to .module.css or append ?modules query
Install sass: npm install sass
Explicitly set namespace if relying on old behavior
npm install esbuild-style-loader
Use import { styleLoader } from 'esbuild-style-loader'Use named import: import { styleLoader } from 'esbuild-style-loader'Rename to style.module.css or import with ?modules