webpack-bundle-analyzer: TypeError: Cannot read property 'forEach' of undefined
Issue description
When running the CLI on a stats file (not all stats files, just some), I’m getting the following error, and the following error only:
Could't analyze webpack bundle:
TypeError: Cannot read property 'forEach' of undefined
It’s not a lot to go on, there aren’t any helpful hints or file names in which it crashes.
Technical info
System:
OS: macOS 11.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 3.08 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.22.0 - ~/.nvm/versions/node/v12.22.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v12.22.0/bin/yarn
npm: 6.14.15 - ~/.nvm/versions/node/v12.22.0/bin/npm
npmPackages:
terser-webpack-plugin: 5.1.3 => 5.1.3
webpack: 5.64.1 => 5.64.1
webpack-cli: 4.7.2 => 4.7.2
webpack-dev-server: 4.7.3 => 4.7.3
webpack-manifest-plugin: 3.1.1 => 3.1.1
Debug info
Using the CLI - npx webpack-bundle-analyzer@latest stats.json, with the following plugins:
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 5
- Comments: 16 (6 by maintainers)
Yes, I asked about a reproduction as a test case and creating a pull request that aims to fix this bug.
I don’t have time right now to tackle this and it seems that this isn’t affecting too many people right now. The quickest way to get this fixed is to help in fixing it as part of open source ☺️
hi. here’s a stats.json file that produces this error, using latest webpack, webpack-cli, webpack-bundle-analyzer:
stats.json.zip
If someone is able to create a pull request that reproduces this case with a test case and also fixes it then I’ll consider accepting it ☺️
@valscion Don’t know about a fix, but both @ilias-t and @thecristen provided Zip files with a reproducible error.
Here’s a
compilation-stats.jsonfile that repros the issue (apologies for it being rather large) compilation-stats.json.zip