rollup-plugin-build-statistics

raw JSON →
0.0.19 verified Mon Apr 27 auth: no javascript

A Rollup plugin that tracks and logs build times to a JSON file, enabling teams to monitor build performance over time. Version 0.0.19 is the latest release (April 2021), part of a monorepo that also includes a webpack variant and a core package. It provides project-level configuration, daily summaries, and a web-based log analyzer. Unlike general logging plugins, it focuses specifically on build duration to help justify infrastructure improvements and detect configuration or hardware issues. The plugin is TypeScript-friendly with included type definitions.

error Error: Cannot find module 'rollup-plugin-build-statistics'
cause Package not installed or missing from node_modules.
fix
Run 'npm install --save-dev rollup-plugin-build-statistics'.
error TypeError: buildStatistics is not a function
cause Default import used incorrectly; likely imported as { buildStatistics } instead of default.
fix
Use 'import buildStatistics from 'rollup-plugin-build-statistics' (no curly braces).
error Error: "projectName" is required
cause Missing required option 'projectName' in plugin configuration.
fix
Add projectName to the plugin options object.
gotcha The plugin writes to the filesystem during builds. Ensure the output directory is writable and consider adding the stats folder to .gitignore.
fix Add 'stats' to your .gitignore file.
gotcha Logs accumulate over time; disk usage may grow if not cleaned. The summary file overwrites daily, but individual logs persist.
fix Periodically delete old log files or implement a rotation strategy.
gotcha plugin name 'buildStatistics' may conflict with other Rollup plugins if not renamed.
fix Use a unique name when importing if collisions occur: import customName from 'rollup-plugin-build-statistics'.
npm install rollup-plugin-build-statistics
yarn add rollup-plugin-build-statistics
pnpm add rollup-plugin-build-statistics

Example Rollup config integrating the build statistics plugin with all configuration options.

import buildStatistics from 'rollup-plugin-build-statistics';

export default {
  input: './src/index.js',
  output: {
    file: 'dist/index.js',
    format: 'cjs',
  },
  plugins: [
    buildStatistics({
      projectName: 'my-app',
      logsDirectoryName: 'stats',
      summaryLogFilename: 'build-stats-summary',
    }),
  ],
};