Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
Overall
score
98%
Build a webpack configuration module that generates bundle analysis reports in different formats.
Your task is to create a webpack configuration module that integrates bundle analysis capabilities. The module should:
Accept a configuration object with the following properties:
mode: A string that determines the output format ('server', 'static', or 'json')outputPath: A string specifying where to save the report file (for 'static' and 'json' modes)port: A number specifying the server port (for 'server' mode, defaults to 8888)autoOpen: A boolean indicating whether to automatically open the browser (for 'server' mode, defaults to true)Return a webpack plugins array that includes the properly configured bundle analyzer
Handle different modes correctly:
@generates
/**
* Creates a webpack plugin configuration for bundle analysis
*
* @param {Object} config - Configuration object
* @param {string} config.mode - Analysis mode: 'server', 'static', or 'json'
* @param {string} [config.outputPath] - Output file path for static/json modes
* @param {number} [config.port=8888] - Server port for server mode
* @param {boolean} [config.autoOpen=true] - Auto-open browser in server mode
* @returns {Array} Array containing configured webpack plugins
*/
function createBundleReporter(config) {
// Implementation here
}
module.exports = { createBundleReporter };Provides bundle visualization and analysis capabilities for webpack builds.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-webpack-bundle-analyzerevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10