/webpack-metrics

A plugin to gather metrics on built files for project data visualization

Primary LanguageJavaScriptMIT LicenseMIT

Build Status Minimum node.js version downloads version GitLab release MIT License Maintenance

Why?

How it works


Install

npm i --save-dev webpack-metrics
yarn add --dev webpack-metrics

Webpack Config

Import webpack-metrics into your Webpack configuration file:

const WebpackMetrics = require('webpack-metrics');

Instantiate new WebpackMetrics(...) class within Webpack's plugin configuration array:

{
  "plugins": [
    new WebpackMetrics()
  ]
}

Options

new WebpackMetrics({
  ...options...
})
Option Types Description Default
--- --- --- ---

options.files

new WebpackMetrics({

})

Tests

Webpack Metrics comes with a number of tests found under /tests. These are here to help you better understand the expectations of each option we covered above.

Simply run npm run test or yarn test from the root of the plugin to run all tests. Running a test will produce a /dist/[test] directories.

If you would like to change a test, update the root package.json file's test script to use any of the /test/*.test.config.js files.