Registry / web-framework / esbuild-plugin-less

esbuild-plugin-less

JSON →
library1.3.38jsnpmunverified

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-less
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-LES
E
esbuild-plugin-less
web-frameworkjavascriptv1.3.38
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lessLoader
import { lessLoader } from 'esbuild-plugin-less'
const lessLoader = require('esbuild-plugin-less')
Named import is the only correct pattern; package is ESM with CommonJS compat, but require() may break in strict ESM contexts.
LessLoaderOptions
import type { LessLoaderOptions } from 'esbuild-plugin-less'
import { LessLoaderOptions } from 'esbuild-plugin-less'
It is a type-only export; use `import type` to avoid runtime errors in bundlers that do not elide types.
default export
import lessLoader from 'esbuild-plugin-less'
const lessLoader = require('esbuild-plugin-less');
There is no default export; only named exports. This import will fail at runtime.

Shows basic usage of lessLoader plugin with LESS options (math always, global variables) in an esbuild build script.

import { build } from 'esbuild'; import { lessLoader } from 'esbuild-plugin-less'; build({ entryPoints: ['src/index.ts'], bundle: true, outdir: 'dist', plugins: [ lessLoader({ math: 'always', globalVars: { primaryColor: '#ff0000', }, }), ], loader: { '.ts': 'ts', }, }).catch(() => process.exit(1));
Debug
Known issues
gotchaCSS Modules only work with files named *.module.less – other .less files are treated as global styles.
fix
Rename your LESS file to include .module.less (e.g., styles.module.less) to enable CSS Modules scoping.
affects: >=1.0.0
deprecatedThe `javascriptEnabled` option in LESS is a security risk and its support may be removed in future versions of less-loader.
fix
Avoid using `javascriptEnabled: true` – prefer static LESS variables and mixins instead of inline JavaScript.
affects: >=1.0.0
breakingIn v1.0.0, the plugin API changed from `lessPlugin()` to `lessLoader()`. Old imports will fail.
fix
Replace `lessPlugin` with `lessLoader` in both imports and usage.
affects: >=1.0.0
gotchaThe `inline` option when set to `true` causes the raw LESS source to be imported as a string instead of compiled CSS, which may break CSS injection.
fix
Ensure you are using the correct mode: `inline: false` (default) for compiled CSS output.
affects: >=1.0.0
Errors
Common errors & fixes
Error: [plugin: less-loader] Cannot find module 'less'
The 'less' package is not installed.
fix
Run `npm install less --save-dev` (or yarn/pnpm equivalent). This package uses less as a transitive dependency.
Error: [plugin: less-loader] Options.math was set to 'parens-division' which is deprecated; use 'always' or 'strict'.
Deprecated LESS math option value used.
fix
Change `math: 'parens-division'` to `math: 'always'` or `math: 'strict'`.
TypeError: (0 , esbuild_plugin_less.lessLoader) is not a function
Using default import instead of named import.
fix
Use `import { lessLoader } from 'esbuild-plugin-less'` instead of `import lessLoader from 'esbuild-plugin-less'`.
Upgrade
Version history
1.3.38latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency required to function as a plugin
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-less — npm install esbuild-plugin-less · libregistry