Skip to content
Speed up development by automatically installing & saving dependencies with Webpack.
JavaScript Other
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Update webpack2 example to Webpack 2.2 and add support for [preset, o… Jan 23, 2017
src feat: add `yarn` integration (#115) Apr 29, 2018
test feat: add `yarn` integration (#115) Apr 29, 2018
.gitignore ignore nyc test coverage Dec 29, 2015
.npmrc Add .npmrc config Dec 28, 2015
.nvmrc Change .nvmrc to v4.2.0 (LTS) May 13, 2016
.travis.yml Remove Node v0.12 from tests Apr 25, 2016 Release v4.0.4 Jul 1, 2016
LICENSE Convert from MIT to JS Foundation Feb 22, 2017 docs: update (#124) Sep 19, 2018
index.js First pass at plugin Jan 23, 2016

npm deps test coverage chat

NPM Install Webpack Plugin

Speed up development by automatically installing & saving dependencies with Webpack.

It is inefficient to Ctrl-C your build script & server just to install a dependency you didn't know you needed until now.

Instead, use require or import how you normally would and npm install will happen automatically to install & save missing dependencies while you work!


$ npm install --save-dev npm-install-webpack-plugin


In your webpack.config.js:

plugins: [
  new NpmInstallPlugin()

This is equivalent to:

plugins: [
  new NpmInstallPlugin({
    // Use --save or --save-dev
    dev: false,
    // Install missing peerDependencies
    peerDependencies: true,
    // Reduce amount of console logging
    quiet: false,
    // npm command used inside company, yarn is not supported yet
    npm: 'tnpm'

You can provide a Function to the dev to make it dynamic:

plugins: [
  new NpmInstallPlugin({
    dev: function(module, path) {
      return [
      ].indexOf(module) !== -1;


npm-install-webpack-plugin demo


  • Works with both Webpack ^v1.12.0 and ^2.1.0-beta.0.
  • Auto-installs .babelrc plugins & presets.
  • Supports both ES5 & ES6 Modules. (e.g. require, import)
  • Supports Namespaced packages. (e.g. @cycle/dom)
  • Supports Dot-delimited packages. (e.g. lodash.capitalize)
  • Supports CSS imports. (e.g. @import "~bootstrap")
  • Supports Webpack loaders. (e.g. babel-loader, file-loader, etc.)
  • Supports inline Webpack loaders. (e.g. require("bundle?lazy!./App")
  • Auto-installs missing peerDependencies. (e.g. @cycle/core will automatically install rx@*)
  • Supports Webpack's resolve.alias & resolve.root configuration. (e.g. require("react") can alias to react-lite)


Eric Clemmons

Jonny Buchanan
You can’t perform that action at this time.