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

3.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

Event Hooks Webpack Plugin

npm npm license

This Webpack plugin is similar to webpack-shell-plugin but it allows executing arbitrary code instead of commands on any compiler hook that is made available by Webpack.

Installation

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

Usage

import EventHooksPlugin from 'event-hooks-webpack-plugin';

export default {
    // ...
    plugins: [
        new EventHooksPlugin({
            initialize: () => {
                // ...
            }
        })
    ]
};

Options

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

Tapable

Webpack's compiler uses Tapable which supports different classes of hooks. This plugin supports synchronous, promise-based, and callback-based hooks through the exported tap, tapPromise and tapAsync methods. By default, the plugin uses tap.

import EventHooksPlugin, { tapPromise, tapAsync } from 'event-hooks-webpack-plugin';

export default {
    // ...
    plugins: [
        new EventHooksPlugin({
            emit: tapAsync(() => {
                // ...
            }),
            run: tapPromise(() => {
                // ...
            })
        })
    ]
};

License

This project is licensed under the MIT license.

Keywords

event

FAQs

Package last updated on 17 Mar 2025

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