You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Less uses Node's require function to load plugins, starting from the current working directory. This approach doesn't account for Yarn PnP's virtual resolution, which means plugins like less-plugin-clean-css may not be found unless they're exposed in a way compatible with Node's require logic. The Less codebase does not have explicit support for Yarn PnP in its plugin loader, so this error is expected in PnP setups where node_modules aren't present and require paths are virtualized. You may need to use a workaround such as running lessc through pnpify, or configuring your workspace so that the plugin is resolvable from the CLI context. There are no documented configuration options or environment variables in Less for custom plugin resolution paths under Yarn PnP as of now. PluginLoader code reference lessc CLI plugin loading logic
This happens because Less's plugin loader uses Node's standard require logic to load plugins, which doesn't work with Yarn PnP's virtual module resolution. Neither running lessc via yarn nor pnpify can fix this, since the loader doesn't support PnP or provide hooks for custom resolution—it's hardcoded to expect node_modules and direct require calls (plugin-loader.js reference).
Workarounds are limited: you could patch or monkey-patch the plugin loader to use Yarn's PnP API, or run Less in a classic node_modules environment. There's no official or documented solution for PnP support in Less at this time. If PnP compatibility is critical for your workflow, you may want to consider raising a feature request.
Activity
dosubot commentedon Sep 17, 2025
Less uses Node's require function to load plugins, starting from the current working directory. This approach doesn't account for Yarn PnP's virtual resolution, which means plugins like less-plugin-clean-css may not be found unless they're exposed in a way compatible with Node's require logic. The Less codebase does not have explicit support for Yarn PnP in its plugin loader, so this error is expected in PnP setups where node_modules aren't present and require paths are virtualized. You may need to use a workaround such as running lessc through pnpify, or configuring your workspace so that the plugin is resolvable from the CLI context. There are no documented configuration options or environment variables in Less for custom plugin resolution paths under Yarn PnP as of now.
PluginLoader code reference
lessc CLI plugin loading logic
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
maddrag0n commentedon Sep 17, 2025
neither
yarn lessc …noryarn pnpify lessc …makes any differencedosubot commentedon Sep 17, 2025
This happens because Less's plugin loader uses Node's standard require logic to load plugins, which doesn't work with Yarn PnP's virtual module resolution. Neither running lessc via yarn nor pnpify can fix this, since the loader doesn't support PnP or provide hooks for custom resolution—it's hardcoded to expect node_modules and direct require calls (plugin-loader.js reference).
Workarounds are limited: you could patch or monkey-patch the plugin loader to use Yarn's PnP API, or run Less in a classic node_modules environment. There's no official or documented solution for PnP support in Less at this time. If PnP compatibility is critical for your workflow, you may want to consider raising a feature request.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.