Vue CLI Webpack Bundle Analyzer Plugin

4.0.0 · active · verified Sun Apr 19

This package provides a Vue CLI plugin that integrates `webpack-bundle-analyzer` into Vue projects, enabling interactive treemap visualizations of webpack output file sizes. It helps developers understand bundle composition and identify large modules efficiently. The current stable version is 4.0.0, which updated the underlying `webpack-bundle-analyzer` dependency to version 4. The plugin primarily operates via `vue.config.js` `pluginOptions` and offers features like separate reports for modern and legacy builds when using Vue CLI's modern mode. It's an essential tool for build optimization in Vue applications, offering a more integrated experience than configuring `webpack-bundle-analyzer` manually. Its release cadence is tied to updates in `webpack-bundle-analyzer` and Vue CLI itself, ensuring compatibility and access to the latest analyzer features.

Common errors

Warnings

Install

Imports

Quickstart

Installs the plugin and demonstrates basic configuration in `vue.config.js` to disable automatic browser opening and specify output.

vue add webpack-bundle-analyzer

// Then, in vue.config.js, configure options:
// vue.config.js
module.exports = {
  pluginOptions: {
    webpackBundleAnalyzer: {
      openAnalyzer: false, // Prevents opening the analyzer report in the browser automatically
      analyzerMode: 'static', // Generates a static HTML file
      reportFilename: 'bundle-report.html' // Custom report filename
    }
  }
};

// To generate the report, build your project:
// npm run build
// (or yarn build)

view raw JSON →