webpack-notifier is a webpack plugin that integrates with node-notifier to provide system-level notifications for webpack build statuses. It's currently at version 1.15.0 and seems to have a moderate release cadence, focusing on stability and compatibility. Key differentiators include its ability to notify on the first run (success/fail), all failed runs, and the first successful run after a failure, remaining silent otherwise to avoid notification spam. It notably improves upon its predecessor, webpack-error-notification, by adding robust support for Windows and eliminating the need for manual `terminal-notifier` installation on OS X, making it more cross-platform friendly. It leverages the underlying `node-notifier` library, which handles platform-specific notification mechanisms. The plugin offers various configuration options for notification titles, content images, and controlling when notifications are triggered (e.g., excluding warnings, always notifying, or only on error).
npm install webpack-notifierVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate webpack-notifier into a basic webpack configuration, showing how to instantiate the plugin and configure common options like `title`, `alwaysNotify`, `contentImage`, `excludeWarnings`, and `skipFirstNotification`.
Check the `node-notifier` documentation for your operating system's specific requirements and install any necessary dependencies manually: `https://github.com/mikaelbr/node-notifier#requirements`
Ensure `terminal-notifier` is uninstalled if it was previously manually installed for older notification plugins, as `webpack-notifier` handles this automatically via `node-notifier`.
Update to `webpack-notifier@1.3.0` or higher to benefit from clearer, prefixed error and warning messages in your system notifications.
Check system preferences/settings for notifications. On macOS, look under 'Notifications & Focus'. On Windows, 'System > Notifications & actions'. Ensure notifications are enabled for the process running webpack.
Use `const WebpackNotifierPlugin = require('webpack-notifier');` for CommonJS or `import WebpackNotifierPlugin from 'webpack-notifier';` for ESM.Consider using the `onlyOnError: true` and `excludeWarnings: true` options to reduce notification frequency, or implement a custom `message` function in the plugin configuration to truncate lengthy error messages before they are passed to the notifier.
Refer to the `node-notifier` 'Requirements' section on its GitHub page (`https://github.com/mikaelbr/node-notifier#requirements`) for your specific OS and install any missing dependencies. Also, check your OS notification settings for the terminal or IDE running webpack.