Skip to content

[Bug]: Webpack Bundle Analyzer shows the empty analysis #7861

@Verthon

Description

@Verthon

Version

System:
    OS: macOS 26.5.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 110.19 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 149.0.7827.55
    Firefox: 151.0.3
    Safari: 26.5
  npmPackages:
    @rsbuild/core: ^2.0.11 => 2.0.11 
    @rsbuild/plugin-react: ^2.0.1 => 2.0.1

Details

I have added the Webpack Bundle Analyzer using this doc https://rsbuild.rs/guide/upgrade/v1-to-v2#remove-performancebundleanalyze however on the latest rsbuild it doesnt provide any analysis, all I have in the terminal is No bundles were parsed. Analyzer will show only original module sizes from stats file.

On the latest RSBuild v1, the same setup was showing the analysis yet I couldn't change the tabs to gzip etc

Setup:

import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";

const analyze = process.env.ANALYZE;
const analyzerMode = analyze ? "static" : "json";

export default defineConfig({
  plugins: [pluginReact()],
  output: {
    cleanDistPath: true,
  },
  tools: {
    rspack: {
      plugins: [
        new BundleAnalyzerPlugin({
          analyzerMode,
          generateStatsFile: analyzerMode === "json",
          openAnalyzer: analyzerMode === "static",
          reportFilename:
            analyzerMode === "json" ? "report.json" : "report.html",
        }),
      ],
    },
  },
});
    "build": "rsbuild build",
    "build:analyze": "ANALYZE=true rsbuild build",

I have prepared the repro for it https://github.com/Verthon/webpack-bundle-analyzer-repro

Thanks, let me know if this is clear

Reproduce link

https://github.com/Verthon/webpack-bundle-analyzer-repro

Reproduce Steps

  1. install dependencies
  2. run npm run build:analyze
  3. check the browser output it won't have the analysis

Alternative flow for RSBuild v1

  1. install RSBuild v1 npm i @rsbuild/plugin-react@1 @rsbuild/core@1
  2. run npm run build:analyze
  3. check the browser output it will display the results, however you can't change the tabs (to gzip/parsed etc)

Metadata

Metadata

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions