This is a pr for webpack 4 support that I'm cloning sot that I can use it in my project, since it hasn't been pulled after 2 months.
Also, changed the name from npm-install-webpack-plugin, because it supports yarn too
!npmnpmnpm-url !depsdepsdeps-url !testtesttest-url !coveragecovercover-url !chatchatchat-url
It sucks to Ctrl-C your build script & server just to install a dependency you didn't know you needed until now.
Instead, use
In your
This is equivalent to:
You can provide a

!npmnpmnpm-url !depsdepsdeps-url !testtesttest-url !coveragecovercover-url !chatchatchat-url
<img width="200" height="200" vspace="" hspace="25"
src="https://cdn.rawgit.com/webpack/media/e7485eb2/logo/icon.svg">
webpack-plugin-install-deps
Speed up development by automatically installing & saving dependencies with Webpack.
It sucks 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!Install
$ npm install --save-dev npm-install-webpack-plugin
Usage
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 [
"babel-preset-react-hmre",
"webpack-dev-middleware",
"webpack-hot-middleware",
].indexOf(module) !== -1;
},
}),
],
Demo

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