Socket
Socket
Sign inDemoInstall

event-hooks-webpack-plugin

Package Overview
Dependencies
77
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    event-hooks-webpack-plugin

Execute JavaScript on any available Webpack event hook


Version published
Weekly downloads
14K
increased by17.02%
Maintainers
1
Install size
6.54 kB
Created
Weekly downloads
 

Readme

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');

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

Promises

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

module.exports = {
    // ...
    plugins: [
        new EventHooksPlugin({
            eventName: new EventHooksPlugin.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

FAQs

Last updated on 23 Mar 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc