4.0.5 • Published 7 years ago
webpack-plugin-install-deps v4.0.5
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
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!
$ npm install --save-dev npm-install-webpack-pluginIn 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;
},
}),
],
- Works with both Webpack
^v1.12.0and^2.1.0-beta.0. - Auto-installs
.babelrcplugins & 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/corewill automatically installrx@*) - Supports Webpack's
resolve.alias&resolve.rootconfiguration. (e.g.require("react")can alias toreact-lite)
4.0.5
7 years ago