{"id":22160,"library":"rollup-plugin-pnp-resolve","title":"rollup-plugin-pnp-resolve","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/arcanis/rollup-plugin-pnp-resolve","tags":["javascript","rollup","yarn","plugnplay","pnp"],"install":[{"cmd":"npm install rollup-plugin-pnp-resolve","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-pnp-resolve","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-pnp-resolve","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required when bundling CommonJS modules alongside PnP-resolved ES modules","package":"rollup-plugin-commonjs","optional":true}],"imports":[{"note":"Package exports a default function; default import works in ESM. In CommonJS, require yields the function directly.","wrong":"const pnpResolve = require('rollup-plugin-pnp-resolve').default","symbol":"default","correct":"import pnpResolve from 'rollup-plugin-pnp-resolve'"},{"note":"CommonJS require returns the function directly, not an object with a named export.","wrong":"const { resolve } = require('rollup-plugin-pnp-resolve')","symbol":"default (CommonJS)","correct":"const resolve = require('rollup-plugin-pnp-resolve')"},{"note":"pnpResolve is a factory function, not a constructor. Call it to get the plugin instance.","wrong":"plugins: [new pnpResolve()]","symbol":"Rollup Plugin","correct":"plugins: [pnpResolve({ extensions: ['.js'] })]"}],"quickstart":{"code":"// rollup.config.js\nimport pnpResolve from 'rollup-plugin-pnp-resolve';\nimport commonjs from 'rollup-plugin-commonjs';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs',\n  },\n  plugins: [\n    commonjs(),\n    pnpResolve({ extensions: ['.js', '.jsx'] })\n  ]\n};","lang":"javascript","description":"Basic Rollup config using PnP resolve with CommonJS support and custom extensions."},"warnings":[{"fix":"Order plugins: commonjs() first, then pnpResolve().","message":"The plugin must be placed after rollup-plugin-commonjs in the plugins array to ensure CommonJS modules are transformed before resolution.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update Rollup to >=1.0.0 and ensure plugin is invoked as a function (e.g., pnpResolve()).","message":"Version 2.0.0 dropped support for Rollup <1.0.0 and changed the API to a function that returns a plugin object.","severity":"breaking","affected_versions":"2.0.0"},{"fix":"Consider using @yarnpkg/plugin-rollup for official Yarn PnP integration.","message":"The package may not be actively maintained; Yarn's PnP support is now built into Yarn's own Rollup plugin and other official tools.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Consult PnP API documentation for valid options (e.g., extensions, basedir).","message":"Options passed to pnpResolve are forwarded to PnP's resolveRequest; not all options may be supported.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.0.0':28 '6':31 'api':19 'custom':47 'depend':86 'direct':82 'elimin':98 'extens':48 'famili':55 'faster':89 'forward':39 'includ':62 'instead':20 'javascript':104 'jest':73,75 'jest-pnp-resolv':74 'modul':11,25,103 'n':16 'need':100 'node':24,30,102 'option':40 'part':52 'play':17 'plug':15 'plugin':3,8,36,50,71 'plugnplay':107 'pnp':4,18,42,57,66,69,76,85,96,108 'pnp-webpack-plugin':68 'project':97 'reliabl':92 'requir':29 'resolut':26,93 'resolv':5,10,58,77,80 'resolverequest':44 'rollup':2,7,34,105 'rollup-plugin-pnp-resolv':1 'support':33 'system':37 'tool':61 'tradit':23,79 'tree':87 'ts':65 'ts-pnp':64 'typescript':63 'unlik':78 'use':12,83 'various':60 'version':27 'webpack':67,70 'yarn':13,95,106","created_at":"2026-04-27T17:03:42.161240+00:00","updated_at":"2026-04-27T17:03:42.161240+00:00","problems":[{"fix":"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).","cause":"Package not installed or Yarn PnP not enabled.","error":"Error: Cannot find module 'rollup-plugin-pnp-resolve'"},{"fix":"In CommonJS: const pnpResolve = require('rollup-plugin-pnp-resolve'). In ESM: import pnpResolve from 'rollup-plugin-pnp-resolve'.","cause":"Using default import in CommonJS or incorrect import syntax.","error":"TypeError: pnpResolve is not a function"},{"fix":"Use pnpResolve() in plugins array, not pnpResolve.","cause":"Calling pnpResolve without invoking it as a function (i.e., passing the function instead of calling it).","error":"Error: Plugin returned something but it is not a valid plugin."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/arcanis/rollup-plugin-pnp-resolve","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-pnp-resolve","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}