https://github.com/turbo87/webpack-notifier
webpack + node-notifier = build status system notifications
https://github.com/turbo87/webpack-notifier
Last synced: about 1 year ago
JSON representation
webpack + node-notifier = build status system notifications
- Host: GitHub
- URL: https://github.com/turbo87/webpack-notifier
- Owner: Turbo87
- License: isc
- Created: 2015-02-12T10:57:30.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T21:05:33.000Z (about 4 years ago)
- Last Synced: 2025-05-15T09:07:56.166Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 623 KB
- Stars: 307
- Watchers: 6
- Forks: 41
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# webpack-notifier
[](https://www.npmjs.com/package/webpack-notifier)
[](https://github.com/Turbo87/webpack-notifier/actions?query=workflow:CI)
[](https://coveralls.io/github/Turbo87/webpack-notifier?branch=master)
[](https://github.com/airbnb/javascript)
[](https://www.npmjs.com/package/webpack-notifier)

This is a [webpack](http://webpack.github.io/) plugin that uses the
[node-notifier](https://github.com/mikaelbr/node-notifier) package to
display build status system notifications to the user.

> This is a fork of the
[webpack-error-notification](https://github.com/vsolovyov/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-notifier`
[Requirements](https://github.com/mikaelbr/node-notifier#requirements)
whether you need to install any additional tools for your OS.
## Usage
In the `webpack.config.js` file:
```js
var WebpackNotifierPlugin = require('webpack-notifier');
var config = module.exports = {
// ...
plugins: [
new WebpackNotifierPlugin(),
]
}
```
## Configuration
### All `node-notifier` options
You can use any [node-notifier](https://www.npmjs.com/package/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.
```js
new WebpackNotifierPlugin({title: 'Webpack'});
```
```js
new WebpackNotifierPlugin({title: function (params) {
return `Build status is ${params.status} with message ${params.message}`;
}});
```
### Emojis in message text
Show status emoji icon before the message.
```js
new WebpackNotifierPlugin({emoji: true});
```
### Content Image
Image shown in the notification. Can be a path string or object with paths.
#### String path:
```js
var path = require('path');
new WebpackNotifierPlugin({contentImage: path.join(__dirname, 'logo.png')});
```
#### Object string path:
```js
var path = require('path');
const statusesPaths = {
success: path.join(__dirname, 'success.png'),
warning: path.join(__dirname, 'warning.png'),
error: path.join(__dirname, 'error.png')
}
new WebpackNotifierPlugin({contentImage: statusesPaths});
```
### Exclude Warnings
If set to `true`, warnings will not cause a notification.
```js
new WebpackNotifierPlugin({excludeWarnings: true});
```
### Always Notify
Trigger a notification every time. Call it "noisy-mode".
```js
new WebpackNotifierPlugin({alwaysNotify: true});
```
### Notify on error
Trigger a notification only on error.
```js
new WebpackNotifierPlugin({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.
```js
new WebpackNotifierPlugin({skipFirstNotification: true});
```