# pnp-webpack-plugin

> plug'n'play resolver for Webpack

Latest version **1.7.0** (published 2021-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install pnp-webpack-plugin
pnpm add pnp-webpack-plugin
yarn add pnp-webpack-plugin
bun add pnp-webpack-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2021-07-21 |
| First published | 2018-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 264 |
| Maintainers | arcanis |
| Keywords | webpack, yarn, plugnplay, pnp |

## Links

- npm: https://www.npmjs.com/package/pnp-webpack-plugin
- Repository: https://github.com/arcanis/pnp-webpack-plugin
- Issues: https://github.com/arcanis/pnp-webpack-plugin/issues
- npm.io page: https://npm.io/package/pnp-webpack-plugin

## Dependencies (1)

- [ts-pnp](https://npm.io/package/ts-pnp.md) ^1.1.6

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.7.0 (latest) — 2021-07-21
- 1.6.4 — 2020-02-18
- 1.6.3 — 2020-02-18
- 1.6.2 — 2020-02-18
- 1.6.1 — 2020-02-18
- 1.6.0 — 2020-01-27
- 1.5.0 — 2019-06-06
- 1.4.3 — 2019-04-21
- 1.4.1 — 2019-03-05
- 1.4.0 — 2019-03-05
- 1.3.1 — 2019-02-22
- 1.3.0 — 2019-02-22
- 1.2.1 — 2018-11-20
- 1.2.0 — 2018-10-26
- 1.1.0 — 2018-09-30
- … 4 more at https://npm.io/package/pnp-webpack-plugin/versions

## README

# <img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png" height="40" align="right" /> [Plug'n'Play](https://github.com/yarnpkg/rfcs/pull/101) resolver for Webpack

[![npm version](https://img.shields.io/npm/v/pnp-webpack-plugin.svg)](https://www.npmjs.com/package/pnp-webpack-plugin)
[![node version](https://img.shields.io/node/v/pnp-webpack-plugin.svg)](https://www.npmjs.com/package/pnp-webpack-plugin)

*This plugin is also available for Jest ([jest-pnp-resolver](https://github.com/arcanis/jest-pnp-resolver)), Rollup ([rollup-plugin-pnp-resolve](https://github.com/arcanis/rollup-plugin-pnp-resolve)), and TypeScript ([ts-pnp](https://github.com/arcanis/ts-pnp))*

## Installation

```
yarn add -D pnp-webpack-plugin
```

## Usage

Simply add the plugin to both the `resolver` and `resolveLoader`:

```js
const PnpWebpackPlugin = require(`pnp-webpack-plugin`);

module.exports = {
  resolve: {
    plugins: [
      PnpWebpackPlugin,
    ],
  },
  resolveLoader: {
    plugins: [
      PnpWebpackPlugin.moduleLoader(module),
    ],
  },
};
```

The `resolve` entry will take care of correctly resolving the dependencies required by your program, and the `resolveLoader` entry will help Webpack find the location of the loaders on the disk. Note that in this case, all loaders will be resolved relative to the package containing your configuration.

In case part of your configuration comes from third-party packages that use their own loaders, make sure they use `require.resolve` - this will ensure that the resolution process is portable accross environments (including when Plug'n'Play isn't enabled), and prevent it from relying on undefined behaviors:

```js
module.exports = {
  module: {
    rules: [{
      test: /\.js$/,
      loader: require.resolve('babel-loader'),
    }]
  },
};
```

## License (MIT)

> **Copyright © 2016 Maël Nison**
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/pnp-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
