{"id":22107,"library":"rollup-plugin-less-modules","title":"rollup-plugin-less-modules","description":"A Rollup plugin that compiles imported LESS files into CSS during bundling. Version 0.1.11 is the latest stable release (no update in several years). Designed for component-based architectures like Angular that need style encapsulation. Alternatives include rollup-plugin-postcss or rollup-plugin-styles; this plugin is lighter but limited to LESS only and lacks modern PostCSS features. It supports source maps, minification via clean-css, and optional separate CSS output file. The repository is archived (not actively maintained).","status":"maintenance","version":"0.1.11","language":"javascript","source_language":"en","source_url":"https://github.com/katrotz/rollup-plugin-less-modules","tags":["javascript","rollup-plugin","less","css"],"install":[{"cmd":"npm install rollup-plugin-less-modules","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-less-modules","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-less-modules","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for CSS post-processing.","package":"postcss","optional":false},{"reason":"Transitive dependency for LESS compilation (installed by default with Node).","package":"less","optional":false}],"imports":[{"note":"Package is ESM-only. Using require() will not work.","wrong":"const lessModules = require('rollup-plugin-less-modules');","symbol":"default","correct":"import lessModules from 'rollup-plugin-less-modules';"},{"note":"Correct named import is actually the default export; there is no named export 'lessModules'.","wrong":"import lessModules from 'rollup-plugin-less-modules';","symbol":"lessModules","correct":"import { lessModules } from 'rollup-plugin-less-modules';"},{"note":"The plugin enables default export (CSS string) and named export 'sourceMap' from .less files. Using namespace import breaks the naming convention.","wrong":"import * as lessModule from './index.less';","symbol":"sourceMap","correct":"import style, { sourceMap } from './index.less';"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport lessModules from 'rollup-plugin-less-modules';\n\nrollup({\n    input: 'src/index.js',\n    output: {\n        file: 'dist/bundle.js',\n        format: 'es'\n    },\n    plugins: [\n        lessModules({\n            output: 'dist/styles.css',\n            sourcemap: 'inline'\n        })\n    ]\n});","lang":"javascript","description":"Configures Rollup to compile imported LESS files and output a separate CSS bundle with inline source maps."},"warnings":[{"fix":"Use an alternative plugin like rollup-plugin-postcss.","message":"The plugin does not work with Rollup >= 2.0 due to the removal of the bundle.transform hook.","severity":"breaking","affected_versions":"<=0.1.11"},{"fix":"Update imports: use `import lessModules from 'rollup-plugin-less-modules';`.","message":"Default export changed from `lessModules` to `default` export in v0.1.0.","severity":"breaking","affected_versions":"<0.1.0"},{"fix":"Pass `sourcemap: true|false|'inline'` directly to the plugin.","message":"The `options.sourceMap` property is deprecated; use `sourcemap` at top-level options instead.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Set `options.filename` relative to project root.","message":"Source maps may have incorrect file paths if `options.filename` is not set in Less options.","severity":"gotcha","affected_versions":">=0.1.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 --save-dev rollup-plugin-less-modules`.","cause":"The package is not installed or is missing from node_modules.","error":"Error: Could not find module 'rollup-plugin-less-modules' from '...'"},{"fix":"Use ES module import: `import lessModules from 'rollup-plugin-less-modules';`.","cause":"Using require() in an ESM-only package, or incorrect import syntax.","error":"TypeError: lessModules is not a function"},{"fix":"Pass `output` as a plugin option, not in Rollup's output config.","cause":"Using output configuration from Rollup plugin incorrectly.","error":"Error: The `output` option is not supported in rollup-plugin-less-modules v0.1.x. Use separate output if needed."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}