{"id":20757,"library":"webpack-event-plugin","title":"webpack-event-plugin","description":"A webpack plugin that executes callbacks after specified compiler hooks (e.g., afterEmit, done). Version 1.1.1 is the latest stable release; no frequent updates. It is similar to on-build-webpack but allows multiple hooks with per-hook callbacks. Useful for running post-build tasks like asset deployment or notification. Limited to webpack 4+ compiler hooks; no tapable integration for async hooks.","status":"active","version":"1.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/derekfinlinson/webpack-event-plugin","tags":["javascript","webpack","event-hook"],"install":[{"cmd":"npm install webpack-event-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-event-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-event-plugin","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package does not provide ESM exports; use CommonJS require.","wrong":"import WebpackEventPlugin from 'webpack-event-plugin'","symbol":"WebpackEventPlugin","correct":"const WebpackEventPlugin = require('webpack-event-plugin')"},{"note":"Constructor expects an array of hook configs, not a single object.","wrong":"new WebpackEventPlugin({ hook: 'done', callback: () => {} })","symbol":"WebpackEventPlugin","correct":"new WebpackEventPlugin([{ hook: 'done', callback: () => {} }])"},{"note":"Must be used as a plugin in webpack's plugins array, not tapped manually.","wrong":"// applied to compiler after compile\ncompiler.hooks.done.tap('Plugin', new WebpackEventPlugin(...))","symbol":"WebpackEventPlugin","correct":"// in webpack config plugins array\nplugins: [new WebpackEventPlugin(...)]"}],"quickstart":{"code":"const WebpackEventPlugin = require('webpack-event-plugin');\n\nmodule.exports = {\n  // ... other webpack config\n  plugins: [\n    new WebpackEventPlugin([\n      {\n        hook: 'afterEmit',\n        callback: (compilation) => {\n          console.log('Build complete! Assets emitted.');\n        }\n      },\n      {\n        hook: 'done',\n        callback: (stats) => {\n          console.log(`Build finished in ${stats.endTime - stats.startTime}ms`);\n        }\n      }\n    ])\n  ]\n};","lang":"javascript","description":"Shows WebpackEventPlugin with afterEmit and done hooks in a webpack config."},"warnings":[{"fix":"Wrap single config in an array: new WebpackEventPlugin([{...}])","message":"Constructor expects an array of hook config objects, not a single object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use webpack's built-in compiler hooks directly for async behavior.","message":"Plugin does not support async hooks or promises; callbacks run synchronously.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Refer to webpack compiler hooks documentation for correct names.","message":"Hook names must match webpack compiler hooks exactly (e.g., 'afterEmit', 'done').","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use only hook names from webpack compiler hooks (e.g., 'done', 'afterEmit').","cause":"Hook name is not a valid webpack compiler hook or is misspelled.","error":"TypeError: compiler.hooks[this.hook] is not a function"},{"fix":"Check webpack version: compiler hooks changed between versions. Use compatible hook names.","cause":"Hook name does not exist on compiler.hooks.","error":"Error: Hook is not defined"},{"fix":"Use require('webpack-event-plugin') and ensure correct spelling.","cause":"Trying to import ES module style with import or misspelling the plugin name.","error":"TypeError: WebpackEventPlugin is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}