Skip to content

alfredosalzillo/memory-usage-webpack-plugin

Repository files navigation

memory-usage-webpack-plugin

CD CI codecov npm version semantic-release

A webpack plugin to measure memory usage during the build process.

Installation

Install the plugin.

npm install memory-usage-webpack-plugin --save-dev

Usage

To use the plugin, add it to your webpack configuration:

const MemoryUsageWebpackPlugin = require('memory-usage-webpack-plugin');

module.exports = {
  // ... other configurations
  plugins: [
    new MemoryUsageWebpackPlugin({
      logTimeout: 1000, // 1 second
      warningThreshold: 100 * 1024 * 1024, // 100 MB
    }),
  ],
};

Options

The plugin accepts the following options:

  • logTimeout (number): The interval in milliseconds to log memory usage. Default: 1000 (1 second).
  • warningThreshold (number): The memory usage threshold in bytes to trigger a warning. Default: 1 * 1024 * 1024 * 1024 (1GB).