Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drylikov/npm_install_webpack_plugin
Speed up development by automatically installing & saving dependencies with Webpack.
https://github.com/drylikov/npm_install_webpack_plugin
Last synced: 8 days ago
JSON representation
Speed up development by automatically installing & saving dependencies with Webpack.
- Host: GitHub
- URL: https://github.com/drylikov/npm_install_webpack_plugin
- Owner: drylikov
- License: mit
- Created: 2024-07-19T22:42:00.000Z (4 months ago)
- Default Branch: drylikov
- Last Pushed: 2024-07-19T22:46:54.000Z (4 months ago)
- Last Synced: 2024-07-20T02:57:31.317Z (4 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
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
```bash
$ npm install --save-dev npm-install-webpack-plugin
```Usage
In your `webpack.config.js`:
```js
plugins: [
new NpmInstallPlugin()
],
```**This is equivalent to**:
```js
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:
```js
plugins: [
new NpmInstallPlugin({
dev: function(module, path) {
return [
"babel-preset-react-hmre",
"webpack-dev-middleware",
"webpack-hot-middleware",
].indexOf(module) !== -1;
},
}),
],
```Demo
![npm-install-webpack-plugin demo](https://cloud.githubusercontent.com/assets/15182/12540538/6a4e8f1a-c2d0-11e5-97ee-4ddaf6892645.gif)
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.
(e.g. `require`, `import`)
- [x] Supports Namespaced packages.
(e.g. `@cycle/dom`)
- [x] Supports Dot-delimited packages.
(e.g. `lodash.capitalize`)
- [x] Supports CSS imports.
(e.g. `@import "~bootstrap"`)
- [x] Supports Webpack loaders.
(e.g. `babel-loader`, `file-loader`, etc.)
- [x] Supports inline Webpack loaders.
(e.g. `require("bundle?lazy!./App"`)
- [x] Auto-installs missing `peerDependencies`.
(e.g. `@cycle/core` will automatically install `rx@*`)
- [x] Supports Webpack's `resolve.alias` & `resolve.root` configuration.
(e.g. `require("react")` can alias to `react-lite`)