CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-webpack-bundle-analyzer

Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap

Overall
score

98%

Overview
Eval results
Files

task.mdevals/scenario-8/

Bundle Analysis Server Manager

Create a utility that starts bundle analysis servers using the webpack-bundle-analyzer package. The utility should handle different port configuration scenarios for development teams working in shared environments.

Requirements

Build a server manager that:

  1. Uses the webpack-bundle-analyzer package to start analysis servers
  2. Supports automatic port assignment for shared development environments
  3. Supports fixed port configuration for dedicated environments
  4. Returns information about the running server including the actual port used

Test Cases

  • Starting a server with automatic port assignment returns a server running on an OS-assigned port @test
  • Starting a server with a specific port number uses that exact port @test
  • When port is set to 0, the server starts on an OS-assigned port @test
  • Multiple servers can be started with automatic port assignment without conflicts @test

Implementation

@generates

API

/**
 * Starts a bundle analysis server
 *
 * @param {Object} stats - Webpack stats object
 * @param {Object} options - Server configuration options
 * @param {number|string} [options.analyzerPort] - Port number, 'auto', or 0 for automatic assignment
 * @param {string} [options.analyzerMode='server'] - Analyzer mode
 * @param {boolean} [options.openAnalyzer=false] - Whether to open browser automatically
 * @returns {Promise<Object>} Object containing server instance and actual port used
 */
async function startAnalysisServer(stats, options = {}) {
  // Implementation here
}

/**
 * Stops a running analysis server
 *
 * @param {Object} server - Server object returned from startAnalysisServer
 * @returns {Promise<void>}
 */
async function stopAnalysisServer(server) {
  // Implementation here
}

module.exports = { startAnalysisServer, stopAnalysisServer };

Dependencies { .dependencies }

webpack-bundle-analyzer { .dependency }

Provides bundle analysis capabilities with flexible port configuration

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-webpack-bundle-analyzer

tile.json