@k88/format-webpack-messages
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@k88/format-webpack-messages

Taken from react-dev-utils, but is published as a standalone package and has Typescript definition.

Installation

Install using

npm install @k88/format-webpack-messages

Usage

Use this to format webpack warnings/errors:

const webpack = require('webpack');
const formatMessages = require('@k88/webpack-format-messages');

const compiler = webpack(/* webpack-config */);

compiler.hooks.done.tap('done', (stats) => {
  const isSuccessful = stats.hasErrors() || stats.hasWarnings();
  
  if (!isSuccessful) {
    const messages = formatMessages(stats);

    if (messages.errors.length) {
      console.log('Failed to compile.');
      messages.errors.forEach(e => console.log(e));
    }

    if (messages.warnings.length) {
      console.log('Compiled with warnings.');
      messages.warnings.forEach(w => console.log(w));
    }  
  }
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    1
  • 1.1.0
    5,116
  • 1.0.1
    3
  • 1.0.0
    0

Package Sidebar

Install

npm i @k88/format-webpack-messages

Weekly Downloads

4,001

Version

2.0.0

License

ISC

Unpacked Size

11.2 kB

Total Files

6

Last publish

Collaborators

  • ktalebian