webpack / webpack/webpack-bundle-analyzer

TypeError: Cannot read property 'forEach' of undefined

Open
#490 16 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

flag: Community help wanted flag: Has reproduction case Status: Ready for PR type: Bug
Dominant language
JavaScript
Stars
12.7k
Forks
514
Avg merge
6d 2h
Merged PRs (30d)
4

Description

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:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the CLI invocation npx webpack-bundle-analyzer@latest stats.json with a stats file that triggers the error, using the listed webpack plugins as context. Trace the CLI's stats-file analysis until the undefined value is identified, then make the failure report actionable and verify that affected stats files no longer produce the unhelpful TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, webpack
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.