Skip to content

fix(core): upgrade webpack-bundle-analyzer to 5.3.0#7389

Merged
chenjiahan merged 1 commit into
web-infra-dev:v1.xfrom
colinaaa:codex/upgrade-webpack-bundle-analyzer-5-3-0
Mar 26, 2026
Merged

fix(core): upgrade webpack-bundle-analyzer to 5.3.0#7389
chenjiahan merged 1 commit into
web-infra-dev:v1.xfrom
colinaaa:codex/upgrade-webpack-bundle-analyzer-5-3-0

Conversation

@colinaaa

Copy link
Copy Markdown
Contributor

Summary

Upgrade webpack-bundle-analyzer from 4.10.2 to 5.3.0 so the upstream writeStats race-condition fix from webpack/webpack-bundle-analyzer#711 is included in Rsbuild.

Note that webpack-bundle-analyzer requires Node.js 20.9.0.

Related Links

Upgrade webpack-bundle-analyzer from 4.10.2 to 5.3.0 so the upstream writeStats race-condition fix from webpack-bundle-analyzer#711 is included in Rsbuild.

While doing that, keep the compiled package layout compatible with the analyzer's runtime asset lookups by executing the bundled entry from dist/index.js, preserving a root index.js wrapper, and copying the package metadata and static viewer assets to the locations used by both 4.x and 5.x releases.

Also add an e2e regression that exercises generateStatsFile with an invalid statsFilename target. The test fails with 4.10.2 because the stats write error escapes as an unhandled EISDIR failure, and passes with 5.3.0 because the plugin now logs the error gracefully without failing the build.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on upgrading the webpack-bundle-analyzer dependency to version 5.3.0. This upgrade is crucial for integrating an upstream fix that addresses a race-condition during stats file writing. To accommodate the new version's requirements and changes, several internal adjustments were made, including modifications to the prebundle configuration to correctly handle asset resolution and an update to the minimum Node.js version required. A new e2e test was also added to enhance robustness by verifying error handling for misconfigured statsFilename options.

Highlights

  • Dependency Upgrade: Upgraded webpack-bundle-analyzer from version 4.10.2 to 5.3.0.
  • Race-Condition Fix: Incorporated an upstream fix for a writeStats race-condition in webpack-bundle-analyzer.
  • Node.js Requirement: The upgraded webpack-bundle-analyzer now requires Node.js 20.9.0 or higher.
  • Compatibility Adjustments: Implemented changes in the prebundle configuration to ensure compatibility with webpack-bundle-analyzer v5, including handling asset paths.
  • New E2E Test: Added an end-to-end test to verify error handling when statsFilename is incorrectly configured as a directory.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades the webpack-bundle-analyzer dependency to version 5.3.0. This upgrade required modifications in prebundle.config.ts to correctly handle the analyzer's bundled assets and public files, ensuring proper path resolution at runtime. Corresponding updates were made to pnpm-lock.yaml and test snapshots. Review comments identified a logical inconsistency in a new e2e test case, where the test description implies an error should be surfaced, but the assertion checks for no build error. Additionally, a potential Node.js compatibility issue was raised, as the new webpack-bundle-analyzer version requires Node.js >= 20.9.0, which conflicts with the project's current engines.node specification of >=18.12.0.

Comment thread e2e/cases/performance/bundle-analyzer/index.test.ts
Comment thread packages/core/package.json
@chenjiahan chenjiahan merged commit cdd0b6a into web-infra-dev:v1.x Mar 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants