done-webpack-plugin

raw JSON →
1.0.3 verified Fri May 01 auth: no javascript

A webpack plugin that registers a callback to be executed when the compiler's 'done' hook is triggered, providing access to compilation stats. Version 1.0.3 is the current stable release. It offers a simple API with optional error callback, distinct from webpack's built-in hooks or other plugin-based approaches.

error TypeError: DoneWebpackPlugin is not a constructor
cause ESM import instead of require.
fix
Use const DoneWebpackPlugin = require('done-webpack-plugin'); instead of import.
error Error: Cannot find module 'webpack'
cause Missing webpack as a peer dependency.
fix
Run npm install --save-dev webpack or ensure webpack is installed.
breaking Requires webpack 4 or later; uses webpack 4's hooks API.
fix Upgrade to webpack 4+.
deprecated Package is not actively maintained; last update was in 2018.
fix Consider using webpack's built-in 'done' hook or a more modern alternative.
gotcha Error callback is not called for compiler errors; only for plugin internal errors.
fix Use webpack's 'error' stats or handle errors in the success callback via stats.hasErrors().
npm install done-webpack-plugin
yarn add done-webpack-plugin
pnpm add done-webpack-plugin

Shows basic usage with success and error callbacks in webpack config.

// webpack.config.js
const DoneWebpackPlugin = require('done-webpack-plugin');
module.exports = {
  plugins: [
    new DoneWebpackPlugin(
      (stats) => {
        console.log('Build finished in', stats.endTime - stats.startTime, 'ms');
      },
      (err) => {
        console.error('Build error:', err);
      }
    )
  ]
};