Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Webpack plugin for displaying a short summary at the end of the build process.

License

Notifications You must be signed in to change notification settings

fabiospampinato/webpack-summary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Summary

Webpack plugin for displaying a short summary at the end of the build process.

Useful for replacing the many lines of Webpack's output to the terminal with a single, concise, customizable line containing all the info you need.

Install

$ npm install --save webpack-summary

Usage

import SummaryPlugin from 'webpack-summary';

const options = {/* ... */};

export default {
  /* ... */
  plugins: [
    /* ... */
    new SummaryPlugin ( options )
  ]
};

Options

The optional options object has the following shape:

{
  normal: {
    entry: template | false,
    chunk: template | false
  },
  watching: {
    entry: template | false,
    chunk: template | false
  }
}

And it defines the templates to use when in watching mode or not.

If a falsy value is used as a template it will not be rendered.

Template

A template is just a string that may contain placeholders, that look like {foo} or {foo.bar}, that will be replaced with the appropriate value.

Some example templates:

[{entry.name}] Bundled into "{entry.asset}" ({entry.size.MB}MB) in {time.s}s

Bundle rebuilt in {time.s}s.

Webpack {stats.version} - Bundled in {time.s} seconds.

Bundled in {time.m} minutes. {stats.errors.length} errors. {stats.warnings.length} warnings.

Placeholders

A placeholder is just a path that retrieves a value from the following object:

{
  stats, // Raw Webpack stats file
  size: { // Size of the bundle, available in different units
    B, // Number of bytes
    KB, // Number of kilobytes
    MB // Number of megabytes
  } ,
  time: { // Time it took to bundle, available in different units
    ms, // Milliseconds
    s, // Seconds
    m // Minutes
  },
  entries: [{ // Array of data about each entries
    name, // Name of the entry
    asset, // Name of the bundled entry file
    size: { // Size of the bundled entry file
      B, // Number of bytes
      KB, // Number of kilobytes
      MB // Number of megabytes
    }
  }]
}

There are also two special paths, entry and chunk, each available in their related templates.

License

MIT © Fabio Spampinato

About

Webpack plugin for displaying a short summary at the end of the build process.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published