webpack-messages

raw JSON →
2.0.4 verified Sat Apr 25 auth: no javascript

A Webpack plugin that formats and displays messages throughout the bundle lifecycle, including compile start, success, warnings, and errors. Version 2.0.4 is the current stable release, compatible with Webpack 3.x and 4.x. It uses kleur for colorization and provides hooks for custom loggers and completion callbacks. Unlike similar plugins, it supports named bundles for multi-compiler setups and has a minimal footprint. Releases are infrequent but address critical compatibility issues and deprecation warnings.

error TypeError: WebpackMessages is not a constructor
cause Importing the package as a named export instead of default.
fix
Use const WebpackMessages = require('webpack-messages'); not const { WebpackMessages } = require('webpack-messages');
error Error: Cannot find module 'webpack-format-messages'
cause Missing peer dependency when installing with npm@3 or older.
fix
Make sure webpack-format-messages is installed: npm install webpack-messages webpack-format-messages
breaking v2.0.0 dropped support for Node <6. If you need older Node, stick with v1.x.
fix Use Node >=6 or downgrade to v1.0.x.
breaking v2.0.0 replaced chalk with ansi-colors and then later switched to kleur. If you rely on color customization via chalk, it may not work.
fix Use v1.x if you need chalk compatibility.
gotcha The package uses CommonJS only; importing via ES module 'import' will fail in bundlers that enforce ESM.
fix Use require('webpack-messages') or configure bundler to allow CJS.
deprecated Switched from 'compilation' to 'compile' event in v1.0.1. If using a plugin that re-triggers compilation (e.g., Hot Module Replacement), onStart might fire multiple times.
fix Update to v1.0.1+.
npm install webpack-messages
yarn add webpack-messages
pnpm add webpack-messages

Adds WebpackMessages plugin to Webpack config with custom logger and bundle name.

// webpack.config.js
const WebpackMessages = require('webpack-messages');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js'
  },
  plugins: [
    new WebpackMessages({
      name: 'client',
      logger: str => console.log(`>> ${str}`)
    })
  ]
};