CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-rollup-plugin-sizes

Show info about files/packages included with your rollup bundle

94

1.09x
Overview
Eval results
Files

task.mdevals/scenario-4/

Bundle Analyzer Plugin

Create a Rollup plugin that analyzes and reports bundle composition by tracking which modules are included in the final bundle.

Requirements

Your plugin should:

  1. Export a factory function that returns a Rollup plugin object
  2. The plugin must have a unique name property
  3. Capture the input configuration during the options phase to understand entry points
  4. Analyze the bundle during the generation phase, after compilation but before writing
  5. Collect information about all modules in the bundle, including their sizes
  6. Report a summary showing total bundle size and the number of modules processed

The plugin should integrate seamlessly with Rollup's build pipeline without blocking or modifying the bundle output.

Test Cases

  • When used with a single entry point, the plugin reports bundle statistics @test
  • When used with multiple entry points (array format), the plugin reports statistics for each bundle @test
  • The plugin correctly captures module sizes using original source lengths @test

Implementation

@generates

API

/**
 * Creates a Rollup plugin that analyzes bundle composition
 *
 * @returns {object} A Rollup plugin object with name, options, and generateBundle hooks
 */
function bundleAnalyzer() {
  // IMPLEMENTATION HERE
}

module.exports = bundleAnalyzer;

Dependencies { .dependencies }

rollup-plugin-sizes { .dependency }

Provides bundle size analysis support.

Install with Tessl CLI

npx tessl i tessl/npm-rollup-plugin-sizes

tile.json