esbuild plugin for compiling LESS files to CSS. Current stable version v1.3.38 (released 2026-04-11), updated regularly via semantic-release. Supports all LESS.js features, CSS Modules via .module.less naming convention, watch mode, custom file filters, and inline mode. Written in TypeScript with bundled types. Requires esbuild >=0.14.0 <0.29 as a peer dependency. Differentiator: minimal configuration, first-class CSS Modules support, and active maintenance.
npm install esbuild-plugin-lessVerified import paths — ran on the pinned version, not inferred.
Shows basic usage of lessLoader plugin with LESS options (math always, global variables) in an esbuild build script.
Rename your LESS file to include .module.less (e.g., styles.module.less) to enable CSS Modules scoping.
Avoid using `javascriptEnabled: true` – prefer static LESS variables and mixins instead of inline JavaScript.
Replace `lessPlugin` with `lessLoader` in both imports and usage.
Ensure you are using the correct mode: `inline: false` (default) for compiled CSS output.
Run `npm install less --save-dev` (or yarn/pnpm equivalent). This package uses less as a transitive dependency.
Change `math: 'parens-division'` to `math: 'always'` or `math: 'strict'`.
Use `import { lessLoader } from 'esbuild-plugin-less'` instead of `import lessLoader from 'esbuild-plugin-less'`.