A Rollup plugin that resolves modules using Yarn's Plug'n'Play (PnP) API instead of the traditional node_modules resolution. Version 2.0.0 requires Node >=6 and supports Rollup's plugin system. It forwards options to PnP's resolveRequest, such as custom extensions. This plugin is part of a family of PnP resolvers for various tools including TypeScript (ts-pnp), Webpack (pnp-webpack-plugin), and Jest (jest-pnp-resolver). Unlike traditional resolvers, it directly uses the PnP dependency tree for faster and more reliable resolution in Yarn PnP projects, eliminating the need for node_modules.
npm install rollup-plugin-pnp-resolveVerified import paths — ran on the pinned version, not inferred.
Basic Rollup config using PnP resolve with CommonJS support and custom extensions.
Order plugins: commonjs() first, then pnpResolve().
Update Rollup to >=1.0.0 and ensure plugin is invoked as a function (e.g., pnpResolve()).
Consider using @yarnpkg/plugin-rollup for official Yarn PnP integration.
Consult PnP API documentation for valid options (e.g., extensions, basedir).
Ensure the package is installed with Yarn PnP (yarn add -D rollup-plugin-pnp-resolve) and that you are using Yarn PnP (not node_modules).
In CommonJS: const pnpResolve = require('rollup-plugin-pnp-resolve'). In ESM: import pnpResolve from 'rollup-plugin-pnp-resolve'.Use pnpResolve() in plugins array, not pnpResolve.