You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

friendly-errors-webpack-plugin

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

friendly-errors-webpack-plugin

Recognizes certain classes of webpack errors and cleans, aggregates and prioritizes them to provide a better Developer Experience

1.7.0
latest
Source
npmnpm
Version published
Weekly downloads
258K
13.53%
Maintainers
2
Weekly downloads
 
Created

What is friendly-errors-webpack-plugin?

The friendly-errors-webpack-plugin is a Webpack plugin that aims to make Webpack error messages more readable and user-friendly. It cleans up the error messages and provides concise, easy-to-understand output, which can be particularly useful during development.

What are friendly-errors-webpack-plugin's main functionalities?

Basic Setup

This code demonstrates the basic setup of the friendly-errors-webpack-plugin in a Webpack configuration. By including the plugin in the plugins array, it will automatically clean up and format error messages.

const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

module.exports = {
  // other webpack config options
  plugins: [
    new FriendlyErrorsWebpackPlugin(),
  ],
};

Custom Error Messages

This code shows how to customize the success messages and clear the console using the friendly-errors-webpack-plugin. The `compilationSuccessInfo` option allows you to specify custom messages to display when the compilation is successful.

const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

module.exports = {
  // other webpack config options
  plugins: [
    new FriendlyErrorsWebpackPlugin({
      compilationSuccessInfo: {
        messages: ['Your application is running here: http://localhost:3000'],
      },
      clearConsole: true,
    }),
  ],
};

Custom Error Formatters

This code demonstrates how to use the `onErrors` option to create custom error formatters. The function provided to `onErrors` will be called with the severity and errors, allowing you to customize how errors are displayed.

const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');

module.exports = {
  // other webpack config options
  plugins: [
    new FriendlyErrorsWebpackPlugin({
      onErrors: function (severity, errors) {
        if (severity !== 'error') {
          return;
        }
        const error = errors[0];
        console.error(error.name);
        console.error(error.message);
      },
    }),
  ],
};

Other packages similar to friendly-errors-webpack-plugin

Keywords

friendly

FAQs

Package last updated on 05 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts