Rollup plugin to compile Less files to CSS, with optional CSS modules support via less-plugin-css-modules. Current stable version is 3.0.1, last updated in 2019; no recent releases. It integrates Less preprocessing into Rollup builds, handling includes/excludes, sourcemaps, and custom output. Different from rollup-plugin-less (v1) by supporting CSS modules and offering more output flexibility. Node >=4 required; primarily used for legacy projects still on Rollup 1.x.
npm install rollup-plugin-less2Verified import paths — ran on the pinned version, not inferred.
Basic Rollup config with Less preprocessing and CSS modules.
Use import RollupPluginLess2 from 'rollup-plugin-less2' instead of import less from 'rollup-plugin-less2'.
Consider using rollup-plugin-postcss or @rollup/plugin-legacy for newer Rollup versions.
Install less-plugin-css-modules and pass it in options.plugins.
Set output to a filename string to write to that path, or a function for custom handling.
Use import RollupPluginLess2 from 'rollup-plugin-less2' or const { default: RollupPluginLess2 } = require('rollup-plugin-less2');Run npm install less-plugin-css-modules --save-dev
Ensure include option covers your Less files, e.g., include: ['src/**/*.less']