利用Webpack进行自动安装和保存依赖:npm-install-webpack-plugin
npm-install-webpack-plugin
通过利用Webpack进行自动安装和保存依赖来加速开发。
Seamlessly works with:
- Javascript (e.g.
require
,import
) - CSS (e.g.
@import "~bootstrap"
) - Webpack loaders (e.g.
babel-loader
,file-loader
, etc.)
Why?
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 install & save missing dependencies while you work!
Installation
$ npm install --save-dev npm-install-webpack-plugin
Usage
In your webpack.config.js
:
plugins: [ new NpmInstallPlugin(), ],
If you have an .npmrc
file in your project, those arguments will be used:
save=true save-exact=true
Alternatively, you can provide your own arguments to npm install
:
plugins: [ new NpmInstallPlugin({ ... cacheMin: 999999 // --cache-min=999999 (prefer NPM cached version) registry: "..." // --registry="..." save: true, // --save saveDev: true, // --save-dev saveExact: true, // --save-exact ... }), ],
License
MIT License 2016 © Eric Clemmons
项目地址: https://github.com/ericclemmons/npm-install-webpack-plugin
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!