fix(core): upgrade webpack-bundle-analyzer to 5.3.0#7389
Conversation
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.
Summary of ChangesHello, 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
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