{"id":21257,"library":"esbuild-plugin-less","title":"esbuild-plugin-less","description":"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.","status":"active","version":"1.3.38","language":"javascript","source_language":"en","source_url":"https://github.com/iam-medvedev/esbuild-plugin-less","tags":["javascript","esbuild","plugin","less","typescript"],"install":[{"cmd":"npm install esbuild-plugin-less","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-less","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-less","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to function as a plugin","package":"esbuild","optional":false}],"imports":[{"note":"Named import is the only correct pattern; package is ESM with CommonJS compat, but require() may break in strict ESM contexts.","wrong":"const lessLoader = require('esbuild-plugin-less')","symbol":"lessLoader","correct":"import { lessLoader } from 'esbuild-plugin-less'"},{"note":"It is a type-only export; use `import type` to avoid runtime errors in bundlers that do not elide types.","wrong":"import { LessLoaderOptions } from 'esbuild-plugin-less'","symbol":"LessLoaderOptions","correct":"import type { LessLoaderOptions } from 'esbuild-plugin-less'"},{"note":"There is no default export; only named exports. This import will fail at runtime.","wrong":"const lessLoader = require('esbuild-plugin-less');","symbol":"default export","correct":"import lessLoader from 'esbuild-plugin-less'"}],"quickstart":{"code":"import { build } from 'esbuild';\nimport { lessLoader } from 'esbuild-plugin-less';\n\nbuild({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outdir: 'dist',\n  plugins: [\n    lessLoader({\n      math: 'always',\n      globalVars: {\n        primaryColor: '#ff0000',\n      },\n    }),\n  ],\n  loader: {\n    '.ts': 'ts',\n  },\n}).catch(() => process.exit(1));","lang":"typescript","description":"Shows basic usage of lessLoader plugin with LESS options (math always, global variables) in an esbuild build script."},"warnings":[{"fix":"Rename your LESS file to include .module.less (e.g., styles.module.less) to enable CSS Modules scoping.","message":"CSS Modules only work with files named *.module.less – other .less files are treated as global styles.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid using `javascriptEnabled: true` – prefer static LESS variables and mixins instead of inline JavaScript.","message":"The `javascriptEnabled` option in LESS is a security risk and its support may be removed in future versions of less-loader.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Replace `lessPlugin` with `lessLoader` in both imports and usage.","message":"In v1.0.0, the plugin API changed from `lessPlugin()` to `lessLoader()`. Old imports will fail.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure you are using the correct mode: `inline: false` (default) for compiled CSS output.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install less --save-dev` (or yarn/pnpm equivalent). This package uses less as a transitive dependency.","cause":"The 'less' package is not installed.","error":"Error: [plugin: less-loader] Cannot find module 'less'"},{"fix":"Change `math: 'parens-division'` to `math: 'always'` or `math: 'strict'`.","cause":"Deprecated LESS math option value used.","error":"Error: [plugin: less-loader] Options.math was set to 'parens-division' which is deprecated; use 'always' or 'strict'."},{"fix":"Use `import { lessLoader } from 'esbuild-plugin-less'` instead of `import lessLoader from 'esbuild-plugin-less'`.","cause":"Using default import instead of named import.","error":"TypeError: (0 , esbuild_plugin_less.lessLoader) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}