webpack-sane-compiler-reporter
raw JSON → 3.3.2 verified Fri May 01 auth: no javascript
A reporter library for the webpack-sane-compiler that provides pretty, customizable console output for webpack compilation events (start, success, failure, invalidate, stats). Version 3.3.2 is the latest stable release. It is designed specifically for webpack-sane-compiler (peer dependency >=2.0.0 <4.0.0) and offers hooks to customize each message type, with defaults that print to stderr. Unlike generic webpack reporters, it integrates tightly with the sane compiler API, supporting features like stats display (true, false, 'once') and fine-grained event-level formatting.
Common errors
error TypeError: startReporting is not a function ↓
cause Using ES import incorrectly: import { startReporting } from '...' instead of default import.
fix
Use import startReporting from 'webpack-sane-compiler-reporter' or const startReporting = require('...')
error Cannot find module 'webpack-sane-compiler' ↓
cause Missing peer dependency 'webpack-sane-compiler'.
fix
Install the peer dependency: npm install webpack-sane-compiler
error options.stats should be a boolean or 'once' ↓
cause Provided an invalid value for stats option (e.g., 'verbose').
fix
Set stats to true, false, or 'once'.
Warnings
breaking v3.0.0 changed the API: the function now returns { stop, options } instead of just stop. ↓
fix Update code to destructure stop and options from the return value.
breaking v2.0.0 removed the 'verbose' option; use 'stats' option instead. ↓
fix Replace verbose: true with stats: 'once' or stats: true.
deprecated The 'printStart', 'printSuccess', etc. custom functions are deprecated in favor of a single 'printer' option? (Check docs). ↓
fix Refer to latest documentation; if not confirmed, use the object-style customization.
gotcha The reporter prints to stderr by default. To capture output, provide a custom 'write' function. ↓
fix Specify write: (msg) => process.stdout.write(msg) to redirect to stdout.
Install
npm install webpack-sane-compiler-reporter yarn add webpack-sane-compiler-reporter pnpm add webpack-sane-compiler-reporter Imports
- default wrong
const { startReporting } = require('webpack-sane-compiler-reporter')correctimport startReporting from 'webpack-sane-compiler-reporter' - startReporting wrong
import { startReporting } from 'webpack-sane-compiler-reporter'correctconst startReporting = require('webpack-sane-compiler-reporter'); - startReporting (returned object) wrong
const stop = startReporting(compiler, {}).stopcorrectconst { stop, options } = startReporting(compiler, {/* options */});
Quickstart
import startReporting from 'webpack-sane-compiler-reporter';
import SaneCompiler from 'webpack-sane-compiler';
import webpack from 'webpack';
const config = { /* webpack config */ };
const compiler = new SaneCompiler(webpack(config));
const { stop, options } = startReporting(compiler, { stats: 'once' });
compiler.run((err, stats) => {
if (err) console.error(err);
// Reports are printed automatically
stop();
});