
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
next-bundle-analyzer
Advanced tools
Webpack Bundle Analyzer is a great tool to analyze the bundles of web applications built on top of Webpack but trying to use it to optimize a large website with many pages can be tricky because you don't know which pages the different chunks belong to.
There is an official wrapper dedicated to Next.js, @next/bundle-analyzer, but it only allows (for now) to generate standard reports for the server and client builds of Next.
This library generates customized Webpack Bundle Analyzer reports in order to make them easier to use for Next users.

We recommend installing next-bundle-analyzer as dev dependency:
npm install -D next-bundle-analyzer
or
yarn add -D next-bundle-analyzer
// next.config.js
const shouldAnalyzeBundles = process.env.ANALYZE === true;
let nextConfig = {
// [...]
};
if (shouldAnalyzeBundles) {
const withNextBundleAnalyzer =
require('next-bundle-analyzer')(/* options come there */);
nextConfig = withNextBundleAnalyzer(nextConfig);
}
module.exports = nextConfig;
⚠️ If next-bundle-analyzer has been installed as dev dependency, itshould be
required conditionally to prevent breaking Next.js in production.
| Option | Values | Default | Description |
|---|---|---|---|
| clientOnly | true false | true | When true, generate only a report for client side build. |
| enabled | true false | true | Allows to enable/disable the plugin. |
| format | 'html' 'json' ['html', 'json'] | 'html' | The format of the report(s) to generate. It can be a single format or a list. |
| html | See HTML options. | {} | Options related to the HTML report. |
| json | See JSON options. | {} | Options related to the JSON report. |
| reportDir | string | 'analyze' | Name of the directory that will contain the reports. Relative to Webpack output path. |
| reportFilename | string | 'bundles''-client' and '-server' suffixes will be added if clientOnly is false. | Name of the report without the extension. |
| Option | Values | Default | Description |
|---|---|---|---|
| open | true false | true | When true, report opens automatically once generated. |
| Option | Values | Default | Description |
|---|---|---|---|
| filter | Object with the same structure than the JSON report to filter. Use true as value to keep a key. | null | Filter to apply to the JSON report in order to keep only some keys. |
FAQs
NextJS version of Webpack Bundle Analyzer.
The npm package next-bundle-analyzer receives a total of 6,966 weekly downloads. As such, next-bundle-analyzer popularity was classified as popular.
We found that next-bundle-analyzer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.