/webpack-export-stats-plugin

Webpack plugin to output export stats from your project

Primary LanguageJavaScriptMIT LicenseMIT

Webpack Export Stats Plugin

Webpack plugin to output export stats graph from your project

npm node deps licenses

Installation

Via npm:

$ npm install webpack-export-stats-plugin --save-dev

Via yarn:

$ yarn add -D webpack-export-stats-plugin

output

Usage

const ExportStatsPlugin = require('webpack-export-stats-plugin');

const webpackConfig = {
  ...
  optimization: {
    usedExports: true,
  },
  plugins: [
    new ExportStatsPlugin({
      patterns: [
        'src/**/*.(js|jsx|css)',
      ],
      exclude: [
        '**/*.(stories|spec).(js|jsx)',
      ],
    })
  ]
}

Configuration

new ExportStatsPlugin(options);

options.patterns (default: ["**/*.*"])

The array of patterns to look for. Directly pass to fast-glob

options.exclude (default: [])

The array of patterns to not look at.

options.context

Current working directoy for patterns above. If you don't set explicitly, your webpack context will be used.

options.output (default: graph.json)

Location where your graph will be created.

options.log (default: info, value: info|verbose)

  • info shows number of used in other modules.
  • verbose contains array of modules which use that export.

options.numberOfMinDeps (default: 2)

Number of minimum dependencies to decide if exported functions is logged.

options.filterFunc (default: undefined)

A filter function which will decide whether module is logged.