
Forked from webpack-contrib/npm-install-webpack-plugin: updated yard add cmd
NPM Install Webpack Plugin
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({
dev: false,
peerDependencies: true,
quiet: false,
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
Maintainers