webpack-sane-compiler-notifier

raw JSON →
2.1.1 verified Fri May 01 auth: no javascript maintenance

Library that sends OS-level notifications (e.g., native desktop notifications) about webpack compilation status when used with webpack-sane-compiler. Current stable version: 2.1.1. Released sporadically; last release 2020. Key differentiators: simple, zero-config API; integrates directly with webpack-sane-compiler's events; supports custom title, icon, and sound.

error TypeError: compiler.hooks is not a function
cause Passed a raw webpack compiler instead of a webpack-sane-compiler instance.
fix
Wrap compiler: const saneCompiler = new WebpackSaneCompiler(compiler); then pass saneCompiler to startNotifying.
error Cannot find module 'webpack-sane-compiler'
cause Missing peer dependency webpack-sane-compiler.
fix
Run: npm install webpack-sane-compiler
error TypeError: Cannot destructure property 'stop' of undefined
cause Using return value from v1 of the package which returned undefined.
fix
Upgrade to v2 and use: const { stop } = startNotifying(compiler);
deprecated Package is in maintenance mode; no active development since 2020.
fix Consider migrating to @webpack-cli/serve or webpack-dev-server for notifications.
gotcha startNotifying expects a webpack-sane-compiler instance, not a raw webpack compiler.
fix Wrap your webpack compiler with new WebpackSaneCompiler(compiler) before passing it.
breaking v2.0.0 changed the return value from undefined to { stop, options }.
fix Update calls to capture destructured { stop, options } from startNotifying.
npm install webpack-sane-compiler-notifier
yarn add webpack-sane-compiler-notifier
pnpm add webpack-sane-compiler-notifier

Shows how to set up OS notifications for webpack builds using webpack-sane-compiler.

const webpack = require('webpack');
const WebpackSaneCompiler = require('webpack-sane-compiler');
const startNotifying = require('webpack-sane-compiler-notifier');

const compiler = webpack({ /* webpack config */ });
const saneCompiler = new WebpackSaneCompiler(compiler);

const { stop } = startNotifying(saneCompiler, {
  title: 'My App',
  sound: true
});

saneCompiler.watch({}, (err, stats) => {
  if (err) console.error(err);
  else console.log('Build done');
});

// Later: stop();