# peer-deps-externals-webpack-plugin

> Webpack plugin to automatically add a library's peerDependencies to its bundle's externals.

Latest version **1.0.4** (published 2018-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install peer-deps-externals-webpack-plugin
pnpm add peer-deps-externals-webpack-plugin
yarn add peer-deps-externals-webpack-plugin
bun add peer-deps-externals-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.0.4 |
| Published | 2018-07-20 |
| First published | 2017-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 76.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Maintainers | updater-admin |
| Keywords | webpack, plugin, peerDependencies, externals, optimize, exclude |

## Links

- npm: https://www.npmjs.com/package/peer-deps-externals-webpack-plugin
- Repository: https://github.com/Updater/peer-deps-externals-webpack-plugin
- Homepage: https://github.com/Updater/peer-deps-externals-webpack-plugin#readme
- Issues: https://github.com/Updater/peer-deps-externals-webpack-plugin/issues
- npm.io page: https://npm.io/package/peer-deps-externals-webpack-plugin

## 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.0.4 (latest) — 2018-07-20
- 1.0.3 — 2018-06-08
- 1.0.2 — 2017-06-30
- 1.0.1 — 2017-04-11
- 1.0.0 — 2017-04-11

## README

# Peer Deps Externals Webpack Plugin
Webpack plugin to automatically add a library's `peerDependencies` to the bundle's `externals`.

## Motivation
When bundling a library using webpack, we generally want to keep from including 
[`peerDependencies`](https://nodejs.org/en/blog/npm/peer-dependencies/) since they are expected to be 
provided by the consumer of the library. By excluding these dependencies, we keep bundle size down and 
avoid bundling duplicate dependencies.

We can achieve this using the webpack [`externals`](https://webpack.js.org/configuration/externals/)
configuration option, providing it a list of the peer dependencies to exclude from the bundle. 
This plugin automates the process, automatically adding a library's `peerDependencies` to the `externals` configuration.

## Installation

### npm
```bash
npm install --save-dev peer-deps-externals-webpack-plugin
```

### yarn
```bash
yarn add --dev peer-deps-externals-webpack-plugin
```

## Usage
```javascript
// Webpack config
var PeerDepsExternalsPlugin = require('peer-deps-externals-webpack-plugin');

module.exports = {
  plugins: [
    new PeerDepsExternalsPlugin(),
  ],
}
```

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