Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Stats parsing is broken when using "all: true" and Webpack 5 #417

Closed
slavafomin opened this issue Feb 16, 2021 · 2 comments · Fixed by #433
Closed

Stats parsing is broken when using "all: true" and Webpack 5 #417

slavafomin opened this issue Feb 16, 2021 · 2 comments · Fixed by #433

Comments

@slavafomin
Copy link

slavafomin commented Feb 16, 2021

Hello!

Thank you for this great tool!

Issue description

However, I've encountered a situation when stats file parsing is broken when using the following stats configuration:

const statsConfig = {
  all: true,
  context: projectPath,
  source: false,
}

and Webpack 5.22.0.

Technical info

The problem is in the assetHasModule function:

function assetHasModule(statAsset, statModule) {
  // Checking if this module is the part of asset chunks
  return statModule.chunks.some(moduleChunk => statAsset.chunks.includes(moduleChunk));
}

It raises the following error:

TypeError: Cannot read property 'some' of undefined

because statModule.chunks is undefined in this case.

In my example the module stat object has the following structure:

{
  "type": "modules by path",
  "name": "…node_modules/.pnpm/core-js@3.8.3/node_modules/core-js/internals/*.js",
  "children": [
    // A big list of modules here
  ],
  "size": 22868,
  "sizes": {
    "javascript": 22868
  }
}

Also, when I change the stats config to use "verbose" preset, the error goes away, but when I view the bundle layout in "parsed" format, it only renders the entry point module. I think something is broken on a more fundamental level.


I've uploaded the obfuscated version of my stats.json file generated with the latest version of the Webpack using "verbose" preset.

@valscion
Copy link
Member

Thanks for the issue! This might be a regression stemming from #395 where the assetHasModule previously used lodash's _.some method, which likely works better when the value given in is undefined.

deanshub added a commit to deanshub/webpack-bundle-analyzer that referenced this issue Apr 11, 2021
deanshub added a commit to deanshub/webpack-bundle-analyzer that referenced this issue Apr 13, 2021
valscion pushed a commit that referenced this issue Apr 13, 2021
* Fixes #417 missing module chunks

* triger build

* test fix

* test fix
@valscion
Copy link
Member

Should be fixed in v4.4.1, thanks to @deanshub via #433. Let us know if the fix works for you ☺️

deanshub added a commit to wix-incubator/webpack-bundle-analyzer that referenced this issue Aug 19, 2021
* Fix tests timeout (webpack-contrib#435)

* Fix tests timeout

* wip

* increasing timeout

* Update test/plugin.js

Co-authored-by: Vesa Laakso <482561+valscion@users.noreply.github.com>

* increasing timeout

Co-authored-by: Vesa Laakso <482561+valscion@users.noreply.github.com>

* Fixes webpack-contrib#417 missing module chunks (webpack-contrib#433)

* Fixes webpack-contrib#417 missing module chunks

* triger build

* test fix

* test fix

* Fix changelog username link texts

* v4.4.1

* Bump url-parse from 1.4.7 to 1.5.1 (webpack-contrib#443)

Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1.
- [Release notes](https://github.com/unshiftio/url-parse/releases)
- [Commits](unshiftio/url-parse@1.4.7...1.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump postcss from 8.1.6 to 8.2.10 (webpack-contrib#446)

Bumps [postcss](https://github.com/postcss/postcss) from 8.1.6 to 8.2.10.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](postcss/postcss@8.1.6...8.2.10)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* check this.compiler.outputFileSystem.constructor is not undefined (webpack-contrib#447)

* check this.compiler.outputFileSystem.constructor is not undefined

* Fix trailing spaces lint

* Update changelog with bug fix

Co-authored-by: Vesa Laakso <482561+valscion@users.noreply.github.com>

* v4.4.2

* Update deps

* Remove unused `exports-loader`

* Bump hosted-git-info from 2.8.8 to 2.8.9 (webpack-contrib#445)

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](npm/hosted-git-info@v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump browserslist from 4.14.6 to 4.16.6 in /test/webpack-versions/5.4.0 (webpack-contrib#450)

Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.14.6 to 4.16.6.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](browserslist/browserslist@4.14.6...4.16.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump dns-packet from 1.3.1 to 1.3.4 (webpack-contrib#451)

Bumps [dns-packet](https://github.com/mafintosh/dns-packet) from 1.3.1 to 1.3.4.
- [Release notes](https://github.com/mafintosh/dns-packet/releases)
- [Changelog](https://github.com/mafintosh/dns-packet/blob/master/CHANGELOG.md)
- [Commits](mafintosh/dns-packet@v1.3.1...v1.3.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws from 7.4.5 to 7.4.6 (webpack-contrib#452)

Bumps [ws](https://github.com/websockets/ws) from 7.4.5 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@7.4.5...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump normalize-url from 4.5.0 to 4.5.1 (webpack-contrib#455)

Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ssri from 6.0.1 to 6.0.2 in /test/webpack-versions/4.44.2 (webpack-contrib#441)

Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](npm/ssri@v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump elliptic from 6.5.3 to 6.5.4 in /test/webpack-versions/4.44.2 (webpack-contrib#421)

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](indutny/elliptic@v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* npm publish

* npm publish

* lint fix

* npmpublic

* name-change

* test title change

* yarnrc

* fixed yarnrc

Co-authored-by: Dean Shub <deanshub@gmail.com>
Co-authored-by: Vesa Laakso <482561+valscion@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kedar <kedarv@users.noreply.github.com>
Co-authored-by: th0r <grunin.ya@ya.ru>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants