Skip to content

Repository files navigation

webpack-notifier

npm VersionGitHub Workflow StatusCoverage StatusCode Style
npmnpm bundle size

This is a webpack plugin that uses the node-notifier package to display build status system notifications to the user.

webpack-notifier screenshot

This is a fork of the webpack-error-notification plugin. It adds support for Windows and there is no need to manually install the terminal-notifier package on OS X anymore.

The plugin will notify you about the first run (success/fail), all failed runs and the first successful run after recovering from a build failure. In other words: it will stay silent if everything is fine with your build.

Installation

Use npm to install this package:

npm install --save-dev webpack-notifier

Check the node-notifierRequirements whether you need to install any additional tools for your OS.

Usage

In the webpack.config.js file:

varWebpackNotifierPlugin=require('webpack-notifier');varconfig=module.exports={// ...plugins: [newWebpackNotifierPlugin(),]}

Configuration

All node-notifier options

You can use any node-notifier options (depending on your OS) Except for options generated by the plugin itself:

  • title - it can be not only a string, but also a function
  • message - generated based on the value of other options
  • contentImage - it can be an object with images for different statuses
  • icon - matches with contentImage

Title

Title shown in the notification.

newWebpackNotifierPlugin({title: 'Webpack'});
newWebpackNotifierPlugin({title: function(params){return`Build status is ${params.status} with message ${params.message}`;}});

Emojis in message text

Show status emoji icon before the message.

newWebpackNotifierPlugin({emoji: true});

Content Image

Image shown in the notification. Can be a path string or object with paths.

String path:

varpath=require('path');newWebpackNotifierPlugin({contentImage: path.join(__dirname,'logo.png')});

Object string path:

varpath=require('path');conststatusesPaths={success: path.join(__dirname,'success.png'),warning: path.join(__dirname,'warning.png'),error: path.join(__dirname,'error.png')}newWebpackNotifierPlugin({contentImage: statusesPaths});

Exclude Warnings

If set to true, warnings will not cause a notification.

newWebpackNotifierPlugin({excludeWarnings: true});

Always Notify

Trigger a notification every time. Call it "noisy-mode".

newWebpackNotifierPlugin({alwaysNotify: true});

Notify on error

Trigger a notification only on error.

newWebpackNotifierPlugin({onlyOnError: true});

Skip Notification on the First Build

Do not notify on the first build. This allows you to receive notifications on subsequent incremental builds without being notified on the initial build.

newWebpackNotifierPlugin({skipFirstNotification: true});

About

webpack + node-notifier = build status system notifications

Resources

Stars

305 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages