{"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,"search_vec":"'1.1.1':19 '4':60 'afteremit':16 'allow':37 'asset':53 'async':67 'build':34,50 'callback':10,44 'compil':13,61 'deploy':54 'done':17 'e.g':15 'event':3,72 'event-hook':71 'execut':9 'frequent':26 'hook':14,39,43,62,68,73 'integr':65 'javascript':69 'latest':22 'like':52 'limit':57 'multipl':38 'notif':56 'on-build-webpack':32 'per':42 'per-hook':41 'plugin':4,7 'post':49 'post-build':48 'releas':24 'run':47 'similar':30 'specifi':12 'stabl':23 'tapabl':64 'task':51 'updat':27 'use':45 'version':18 'webpack':2,6,35,59,70 'webpack-event-plugin':1","created_at":"2026-04-25T11:24:48.851060+00:00","updated_at":"2026-04-25T11:24:48.851060+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/derekfinlinson/webpack-event-plugin","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/webpack-event-plugin","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}