📜  WebpackNotifierPlugin (1)

📅  最后修改于: 2023-12-03 15:05:55.512000             🧑  作者: Mango

WebpackNotifierPlugin

WebpackNotifierPlugin is a plugin for Webpack which displays desktop notifications once the build is complete. This plugin is useful for developers who want to be notified when the build is ready, without having to constantly check the terminal.

Installation

You can install WebpackNotifierPlugin using npm:

npm install --save-dev webpack-notifier
Usage

To use WebpackNotifierPlugin, you need to add it to your Webpack configuration:

const WebpackNotifierPlugin = require('webpack-notifier');

module.exports = {
  // ... webpack config
  plugins: [
    new WebpackNotifierPlugin({
      title: 'Webpack',
      contentImage: path.join(path.dirname(__dirname), 'icon.png'),
      excludeWarnings: true,
      alwaysNotify: true,
    }),
  ],
};
Options
  • title: The title of the desktop notification.
  • contentImage: The path to the image displayed in the notification.
  • excludeWarnings: Whether to exclude warnings from the notifications.
  • alwaysNotify: Whether to always display notifications, regardless of the result of the build.
Conclusion

WebpackNotifierPlugin is a simple and useful plugin for developers who want to be notified when the build is complete. With this plugin, you can avoid the need to constantly check the terminal and stay focused on your work.