You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

event-hooks-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-hooks-webpack-plugin

Execute JavaScript on any available Webpack event hook

2.2.0
Source
npmnpm
Version published
Weekly downloads
11K
-8.92%
Maintainers
1
Weekly downloads
 
Created
Source

Event Hooks Webpack Plugin

npm npm license

This webpack plugin is similar to webpack-shell-plugin but this allows you to execute arbitrary JavaScript instead of commands on any event hook that is exposed by the Webpack compiler.

Installation

npm install event-hooks-webpack-plugin --save-dev

Synchronous usage

const EventHooksPlugin = require('event-hooks-webpack-plugin');

module.exports = {
    // ...
    plugins: [
        new EventHooksPlugin({
            eventName: () => {
                // ...
            }
        })
    ]
};

Asynchronous usage

Callbacks

const EventHooksPlugin = require('event-hooks-webpack-plugin');
const { CallbackTask } = require('event-hooks-webpack-plugin/lib/tasks');

module.exports = {
    // ...
    plugins: [
        new EventHooksPlugin({
            eventName: new CallbackTask((compiler, callback) => {
                // ...
                callback();
            })
        })
    ]
};

Promises

const EventHooksPlugin = require('event-hooks-webpack-plugin');
const { PromiseTask } = require('event-hooks-webpack-plugin/lib/tasks');

module.exports = {
    // ...
    plugins: [
        new EventHooksPlugin({
            eventName: new PromiseTask(async () => {
                // ...
            })
        })
    ]
};

Options

The plugin consumes an object with webpack compiler event hook names (e.g. run, compile, or done) as keys and functions or task classes as values.

License

This project is licensed under the MIT license.

Keywords

event

FAQs

Package last updated on 02 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts