Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webpack-bundle-analyzer

Package Overview
Dependencies
Maintainers
4
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webpack-bundle-analyzer

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

  • 4.10.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2M
increased by3.03%
Maintainers
4
Weekly downloads
 
Created

What is webpack-bundle-analyzer?

The webpack-bundle-analyzer package is a tool for analyzing the size of webpack output files. It helps developers understand where code bloat is coming from by visualizing the size of webpack-generated bundles and how they are related. It can be used to optimize the size of the output by identifying large chunks and their dependencies.

What are webpack-bundle-analyzer's main functionalities?

Visualizing Size of Webpack Bundles

This feature allows developers to visualize the size of their webpack bundles. The code sample shows how to include the BundleAnalyzerPlugin in a webpack configuration.

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
  plugins: [
    new BundleAnalyzerPlugin()
  ]
};

Customizing the Analyzer Report

Developers can customize the analyzer's report output by specifying options such as the mode, report filename, and whether to automatically open the report. The code sample demonstrates how to set these options.

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
  plugins: [
    new BundleAnalyzerPlugin({
      analyzerMode: 'static',
      reportFilename: 'bundle_sizes.html',
      openAnalyzer: false
    })
  ]
};

Analyzing Bundle Content

This feature generates a detailed JSON file with statistics about the bundle's content, which can be further analyzed or tracked over time. The code sample shows how to enable this feature and set the stats file name.

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
  plugins: [
    new BundleAnalyzerPlugin({
      generateStatsFile: true,
      statsFilename: 'bundle_stats.json'
    })
  ]
};

Other packages similar to webpack-bundle-analyzer

Keywords

FAQs

Package last updated on 11 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc