{"id":26645,"library":"webpack-compiler-plugin","title":"Webpack Compiler Plugin","description":"Webpack Compiler Plugin (v1.1.5) lets you execute custom commands at key webpack compiler hook stages: buildStart, compileStart, compileEnd, and buildEnd. It wraps commands asynchronously and supports disabling stage messages. Last updated November 2020 with maintenance-only commits; no releases since. Differentiator: simple declarative API for hooking into webpack lifecycle without manual plugin wiring. Requires Node >=8, npm >=6, and webpack (peer dependency). Ships TypeScript type definitions.","status":"maintenance","version":"1.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/iamogbz/webpack-compiler-plugin","tags":["javascript","compile","plugin","shell","webpack","typescript"],"install":[{"cmd":"npm install webpack-compiler-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-compiler-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-compiler-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency – the plugin hooks into webpack compiler lifecycle","package":"webpack","optional":false}],"imports":[{"note":"ESM import supported; CJS require works but named export is required.","wrong":"const WebpackCompilerPlugin = require('webpack-compiler-plugin')","symbol":"WebpackCompilerPlugin","correct":"import { WebpackCompilerPlugin } from 'webpack-compiler-plugin'"},{"note":"Type-only import needed for TypeScript users to avoid runtime value import.","wrong":"import { WebpackCompilerPluginOptions } from 'webpack-compiler-plugin'","symbol":"WebpackCompilerPluginOptions","correct":"import type { WebpackCompilerPluginOptions } from 'webpack-compiler-plugin'"},{"note":"Enum exported for stage type hints; ESM and CJS both work.","wrong":"","symbol":"Stages","correct":"import { Stages } from 'webpack-compiler-plugin'"}],"quickstart":{"code":"// webpack.config.js\nimport { WebpackCompilerPlugin } from 'webpack-compiler-plugin';\n\nexport default {\n  mode: 'development',\n  plugins: [\n    new WebpackCompilerPlugin({\n      name: 'my-plugin',\n      listeners: {\n        buildStart: () => console.log('Build started'),\n        compileEnd: () => console.log('Compilation ended'),\n      },\n      stageMessages: false, // disable stage messages\n    }),\n  ],\n};","lang":"javascript","description":"Configures the plugin to run custom functions at buildStart and compileEnd, with stage messages disabled."},"warnings":[{"fix":"Update to v1.1.4+ where async functions are properly wrapped and return a promise.","message":"Listener functions must return a Promise or be synchronous; async functions are wrapped but not all callbacks are awaited.","severity":"gotcha","affected_versions":">=1.0.0 <1.1.4"},{"fix":"Explicitly set `stageMessages: false` to disable stage messages.","message":"The `stageMessages` option defaults to `true` but can be set to `null` to disable; in future versions this may change.","severity":"deprecated","affected_versions":">=1.1.0"},{"fix":"Install webpack: `npm install --save-dev webpack`.","message":"Requires webpack as a peer dependency; installing without webpack will cause runtime errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use exclusively in Node.js webpack configurations.","message":"The plugin only runs in Node.js environments; not usable in browser-based bundler integrations.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install webpack-compiler-plugin --save-dev` and ensure it's in package.json.","cause":"Package not installed or missing from dependencies.","error":"Error: Cannot find module 'webpack-compiler-plugin'"},{"fix":"Change to `import { WebpackCompilerPlugin } from 'webpack-compiler-plugin'`.","cause":"Wrong import style – using default import instead of named import.","error":"TypeError: WebpackCompilerPlugin is not a constructor"},{"fix":"Run `npm install webpack --save-dev`.","cause":"webpack peer dependency not installed.","error":"Error: Cannot find module 'webpack'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}