Registry / serialization / rollup-plugin-less

rollup-plugin-less

JSON →
library1.1.3jsnpmunverified

A Rollup plugin for compiling Less files to CSS. Current stable version is 1.1.3, released in 2020. It supports inserting CSS into the DOM or writing to a file. Minimal configuration, but limited flexibility compared to alternatives like rollup-plugin-postcss. Not actively maintained; last commit was in 2021.

npm install rollup-plugin-less
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-LESS
R
rollup-plugin-less
serializationjavascriptv1.1.3
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.

default (less)
import less from 'rollup-plugin-less'
const less = require('rollup-plugin-less')
Package does not export a named function; default import only.
Options
import type { LessOptions } from 'rollup-plugin-less'
For TypeScript users, types are provided; use type import for options.
less function
const less = require('rollup-plugin-less').default
const less = require('rollup-plugin-less')
In CommonJS, the default export is accessed via .default.

Basic Rollup config using rollup-plugin-less to compile .less files and output a CSS bundle.

// rollup.config.js import less from 'rollup-plugin-less'; export default { input: 'src/main.js', output: { file: 'dist/bundle.js', format: 'es' }, plugins: [ less({ insert: true, output: 'dist/styles.css' }) ] };
Debug
Known issues
gotchaThe plugin expects less to be installed as a peer dependency; if not present, it will throw a runtime error.
fix
Run npm install less --save-dev alongside the plugin.
affects: >=1.0.0
gotchaWhen insert is true, CSS is injected into <head> only in browser environments; it will fail in Node.js SSR contexts.
fix
Use output option to write CSS to a file for SSR compatibility.
affects: >=1.0.0
deprecatedThe option 'useDefault' is not supported; the plugin always uses the less default render.
fix
Remove any 'useDefault' option from plugin configuration.
affects: >=1.1.0
Errors
Common errors & fixes
Error: Cannot find module 'less'
Less is not installed or not found in node_modules.
fix
npm install less --save-dev
TypeError: Cannot read properties of undefined (reading 'render')
Incorrect import; using require without .default in CommonJS.
fix
Use require('rollup-plugin-less').default or switch to ES import.
Error: Plugin returned an object, but expected an object with code or map property
Plugin version incompatibility with Rollup 2+; the plugin's transform hook returns undefined for non-Less files.
fix
Update to the latest version or ensure include/exclude patterns are correct.
Upgrade
Version history
1.1.3latest on npm
Audit
Dependencies
lessrequiredCore dependency for Less compilation; must be installed separately.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-less — npm install rollup-plugin-less · libregistry