You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getViewerData throws "Maximum call stack size exceeded" when a chunk has about 130,000 modules #752
Yes. AI tools accelerated this work: finding the bug and writing the reproduction. I reviewed it and ran the reproduction.
Bug Description
When one chunk in the stats lists about 130,000 modules or more, getViewerData throws RangeError: Maximum call stack size exceeded, so the plugin and the CLI log "Couldn't analyze webpack bundle" and produce no report. I found this while reading src/analyzer.js: flatten() copies each chunk's module list with res.push(...cur), which passes every module as a separate call argument.
Link to Minimal Reproduction and step to reproduce
The chart data is returned, as it is for smaller chunks.
Actual Behavior
RangeError: Maximum call stack size exceeded
at flatten (node_modules/webpack-bundle-analyzer/lib/analyzer.js:75:11)
Environment
webpack-bundle-analyzer 5.4.2 (same on main at cec6ac6)
Node.js 22.23.2, Windows 11
Is this a regression?
Yes (please specify version below)
Last Working Version
4.9.1
Additional Context
4.9.1 handles 500,000 modules in one chunk and 4.10.0 fails at 130,000. #612 replaced lodash.flatten, which copies in a loop, with the local flatten. Copying the elements in a loop fixes it. I have a fix and a test ready if that is fine with you.
Activity