before-build-webpack

Webpack plugin that gives ability to add callback before build (or at any other event hook). Can stop compilation by condition.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
before-build-webpack
1600.2.153 months ago7 years agoMinified + gzip package size for before-build-webpack in KB

Readme

before-build-webpack
Webpack (v1-5) plugin that gives ability to add callback before build (or after, or any other event hook). Can stop compilation by condition. tests status NPM Downloads

Installation

``` npm install --save-dev before-build-webpack ```

Usage

In config file: ``` javascript var WebpackBeforeBuildPlugin = require('before-build-webpack'); // ... module: {
plugins: [
new WebpackBeforeBuildPlugin(function(stats, callback) {
// Do whatever you want...
callback(); // don't call it if you do want to stop compilation
}),
]
}, // ... ```

OR (more power)

``` javascript // ... module: {
plugins: [
new WebpackBeforeBuildPlugin(function(stats, callback) {
// ...
}, ['run', 'watch-run', 'done']), // will fire before build and after build
]
}, // ... ``` You can use pre-v4 or v4 hook names (i.e. any of watch-run and watchRun)