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.
npm install vue-cli-plugin-webpack-bundle-analyzerVerified import paths — ran on the pinned version, not inferred.
Installs the plugin and demonstrates basic configuration in `vue.config.js` to disable automatic browser opening and specify output.
Review the `webpack-bundle-analyzer` v4 documentation for changes to plugin options and update your `vue.config.js` configuration accordingly.
Ensure `reportFilename` in your `pluginOptions.webpackBundleAnalyzer` is a full file path if you intend to specify a custom directory or file structure.
Explicitly set `openAnalyzer: false` in your `pluginOptions.webpackBundleAnalyzer` within `vue.config.js` to prevent the browser from opening.
To view `parsed` and `gzipped` sizes, perform a full production build (`npm run build` or `yarn build`).
When using `--modern`, check for both `legacy-your-report.html` and `modern-your-report.html` (or similar, depending on your `reportFilename` setting) in your output directory.
Ensure your `vue.config.js` includes `module.exports = { pluginOptions: { webpackBundleAnalyzer: { /* ... */ } } };` and that `webpackBundleAnalyzer` is an object.Check `pluginOptions.webpackBundleAnalyzer.openAnalyzer` in `vue.config.js`. Set it to `true` if you want it to open automatically (default for production). Alternatively, manually open the generated HTML report file from your output directory.
Verify if you built with `vue-cli-service build --modern`. If not, the report won't be prefixed with `legacy-` or `modern-`. Adjust the filename you are looking for, or ensure your build command includes `--modern` if two reports are desired.