Skip to content

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

License

Notifications You must be signed in to change notification settings

Updater/peer-deps-externals-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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 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

npm install --save-dev peer-deps-externals-webpack-plugin

yarn

yarn add --dev peer-deps-externals-webpack-plugin

Usage

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

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •