Registry / devops / webpack-notifier-2

webpack-notifier-2

JSON →
library2.5.0jsnpmunverified

webpack-notifier-2 is a webpack plugin designed to provide system desktop notifications about the status of webpack builds. As a fork of the original webpack-notifier and webpack-error-notification plugins, it specifically addresses cross-platform compatibility, offering out-of-the-box support for Windows and eliminating the need for manual terminal-notifier installations on OS X. The plugin, currently at stable version 2.5.0, focuses on delivering notifications for the first build (success/fail), all subsequent failed builds, and the first successful build after a failure, remaining silent when builds are consistently successful. Recent updates, including a 'timeout' option and default notification images, contribute to a more 'zero-config' experience. This indicates an active development cadence with ongoing minor feature additions and bug fixes. It fundamentally relies on the node-notifier package for its core notification capabilities.

npm install webpack-notifier-2
INSTALL
IMPORT
SIG · WEBPACK-NOTIFIER-2
W
webpack-notifier-2
devopsjavascriptv2.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebpackNotifierPlugin
const WebpackNotifierPlugin = require('webpack-notifier-2');
const WebpackNotifierPlugin = require('webpack-notifier');
The package name is 'webpack-notifier-2', not the legacy 'webpack-notifier'. Webpack configuration files are typically CommonJS.
WebpackNotifierPlugin
import WebpackNotifierPlugin from 'webpack-notifier-2';
import { WebpackNotifierPlugin } from 'webpack-notifier-2';
This plugin exports a default class. For ESM environments, import the default. Named imports will fail.
WebpackNotifierPlugin
new WebpackNotifierPlugin();
plugins: [ WebpackNotifierPlugin ]
The plugin must be instantiated as a class with `new` when added to the webpack configuration's `plugins` array.

Sets up webpack-notifier-2 in a basic webpack configuration to display system notifications for build status. This example shows basic configuration and usage.

const path = require('path'); const WebpackNotifierPlugin = require('webpack-notifier-2'); module.exports = { mode: 'development', entry: './src/index.js', // Ensure 'src/index.js' exists (can be empty) output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist'), }, plugins: [ new WebpackNotifierPlugin({ title: 'My Webpack Build', alwaysNotify: true, // Example: enables notifications for all builds // contentImage: path.join(__dirname, 'assets', 'logo.png') // Optional: path to a custom image }), ], // Run 'npm install webpack webpack-cli webpack-notifier-2' and create 'src/index.js' and 'dist/' // Then 'npx webpack' to test. };
Debug
Known issues
gotchawebpack-notifier-2 relies on node-notifier, which may have additional platform-specific requirements (e.g., specific binaries or tools for macOS, Linux) that need to be installed manually for notifications to function.
fix
Refer to the 'node-notifier' package's documentation for platform-specific installation requirements and ensure all necessary system tools are in place.
affects: >=1.0.0
breakingThe package name changed from 'webpack-notifier' to 'webpack-notifier-2'. Using the old package name in 'require' or 'import' statements will result in a 'module not found' error.
fix
Update your `package.json` and all `require()`/`import` statements to use `webpack-notifier-2`.
affects: >=1.0.0
gotchaThe plugin must be instantiated with `new WebpackNotifierPlugin()` and included in the `plugins` array of your webpack configuration. Simply providing `WebpackNotifierPlugin` without `new` will not work.
fix
Ensure your webpack config `plugins` array contains `new WebpackNotifierPlugin(...)`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack-notifier'
Incorrect package name specified in `require()` or `import` statement.
fix
Change the import/require path to `webpack-notifier-2` (e.g., `require('webpack-notifier-2')`).
TypeError: WebpackNotifierPlugin is not a constructor
Attempting to use `WebpackNotifierPlugin` without instantiating it with `new`, or importing it incorrectly.
fix
Ensure you are using `new WebpackNotifierPlugin(...)` in your `plugins` array and that you are importing it as a default export (e.g., `const WebpackNotifierPlugin = require('webpack-notifier-2');`).
No notifications appear even after successful builds.
Common causes include missing platform-specific `node-notifier` dependencies, or misconfiguration options like `excludeWarnings`, `onlyOnError`, or `skipFirstNotification`.
fix
Verify `node-notifier` requirements for your OS are met. Check `webpack-notifier-2` options: ensure `excludeWarnings` is not true if you want warning notifications, and `onlyOnError` is not true if you want success notifications. Consider `alwaysNotify: true` for testing.
Upgrade
Version history
2.5.0latest on npm
Audit
Dependencies
webpackoptionalRequired as a peer dependency for any webpack plugin to function within a webpack configuration.
node-notifierrequiredCore dependency for displaying system notifications. May require platform-specific native tools to be installed.
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
webpack-notifier-2 — npm install webpack-notifier-2 · libregistry