Output webpack stats file with webpack-stats-plugin

Step 1. Install

npm install --save-dev webpack-stats-plugin
# or 
yarn add --dev webpack-stats-plugin

Step 2. Configure

// webpack.config.js
const { StatsWriterPlugin } = require('webpack-stats-plugin');

module.exports = {
  // ... your webpack config
  plugins: [
    // ... other plugins

    // Write out stats file to build directory.
    new StatsWriterPlugin({
      filename: 'stats.json',
      stats: {
        context: './src', // optional, will improve readability of the paths
        assets: true,
        entrypoints: true,
        chunks: true,
        modules: true
      }
    })
  ]
};



Need help?Contact us via email, Twitter, or Github!