Conveniently Lazy Load Webpack Plugins from Webpack Builtin Plugins or from Package Dependencies.
npm install --save-dev load-webpack-plugins
or using yarn
yarn add load-webpack-plugins
Webpack Builtin plugins can be conveniently lazy loaded without remembering the nested path references.
var $ = require('load-webpack-plugins')();
...
module.exports = function() {
...
plugins: [
new $.APIPlugin(options),
new $.DllPlugin(options),
new $.UglifyJsPlugin(options),
]
...
}
Please refer plugins.json for up to date list of supported plugins.
Given a package.json
file that has webpack plugins in dependencies
or devDependencies
:
{
"<d|devD>ependencies": {
"webpack-html-plugin": "*",
"assets-webpack-plugin": "*",
}
}
Webpack plugins can be conveniently lazy loaded in webpack.config.js
.
var $ = require('load-webpack-plugins')();
...
module.exports = function() {
...
plugins: [
new $.AssetsPlugin(options),
new $.HtmlPlugin(options),
]
...
}
- Support Webpack Plugins published as Private/Scoped NPM Packages
- Support Custom patterns for Plugins Discovery
- Support Custom name transform function in option.
Thanks to @sindresorhus for awesome load-grunt-plugins