Registry / devops / pnp-webpack-plugin

pnp-webpack-plugin

JSON →
library1.7.0jsnpmunverified

Webpack plugin for Yarn Plug'n'Play (PnP) resolution, version 1.7.0. It integrates PnP into Webpack's resolver and resolveLoader, allowing dependencies to be resolved from zip archives without node_modules. Updated occasionally; key differentiator: enables PnP in Webpack builds where packages are hoisted into compressed archives, avoiding disk I/O for package resolution. Alternatives include manual resolve.alias configuration or disabling PnP.

npm install pnp-webpack-plugin
INSTALL
IMPORT
SIG · PNP-WEBPACK-PLUGIN
P
pnp-webpack-plugin
devopsjavascriptv1.7.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default plugin
const PnpWebpackPlugin = require('pnp-webpack-plugin');
import PnpWebpackPlugin from 'pnp-webpack-plugin';
The package is CommonJS only; ESM import via Babel or TypeScript may fail without interop.
moduleLoader
PnpWebpackPlugin.moduleLoader(module)
PnpWebpackPlugin.moduleLoader()
moduleLoader requires the `module` object (typically from Node.js) to resolve loaders relative to the config file.
PnpWebpackPlugin as WebpackPluginInstance
PnpWebpackPlugin
new PnpWebpackPlugin()
The plugin is not a constructor; it is already an instance of WebpackPluginInstance.

Shows minimal Webpack config adding PnP resolver for both modules and loaders.

const PnpWebpackPlugin = require('pnp-webpack-plugin'); module.exports = { resolve: { plugins: [PnpWebpackPlugin], }, resolveLoader: { plugins: [PnpWebpackPlugin.moduleLoader(module)], }, };
Debug
Known issues
gotchaWhen using PnP, loaders must be resolved via require.resolve() in webpack config rules to avoid resolution failures.
fix
Replace loader name string with require.resolve('loader-name').
affects: >=1.0.0
deprecatedThe package is not actively maintained; Webpack 5 may require alternative integration.
fix
Consider using @yarnpkg/pnpify or webpack's built-in PnP support.
affects: >=1.7.0
gotchaDoes not resolve loaders inside node_modules automatically; moduleLoader must be used.
fix
Always add resolveLoader.plugins with PnpWebpackPlugin.moduleLoader(module).
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'some-loader'
Loader referenced by string name, not require.resolve; PnP cannot resolve it.
fix
Use require.resolve('some-loader') in the loader option.
Module not found: Error: Can't resolve 'some-package'
PnP resolver not configured in resolve.plugins.
fix
Add PnpWebpackPlugin to resolve.plugins in webpack config.
TypeError: PnpWebpackPlugin is not a constructor
Using new PnpWebpackPlugin() instead of direct reference.
fix
Remove 'new' keyword: resolve: { plugins: [PnpWebpackPlugin] }
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
webpackrequiredRequired peer dependency for resolver plugin integration
Agent activity
2 hits · last 30 days
node
2
Resources
pnp-webpack-plugin — npm install pnp-webpack-plugin · libregistry