question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

isAsyncChunkPushExpression is checking for left side which cannot be easily determined

See original GitHub issue

Issue description

https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/757c12e03b8260b3428db1c618224a90b69569c1/src/parseUtils.js#L191-L214

These lines https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/757c12e03b8260b3428db1c618224a90b69569c1/src/parseUtils.js#L201-L208

Are checking if .push is called on window, self or this. So for the simple cases:

window.webpackJsonp_someCustomName = (window.webpackJsonp_someCustomName || []).push(...)

it works well.

But sometimes Webpack creates left side output which can be MemberExpression:

(("undefined" != typeof self ? self : this).webpackJsonp_someCustomName = ("undefined" != typeof self ? self : this).webpackJsonp_someCustomName || []).push(...);

I am thinking is there any need for checking of the left side? We are already checking a lot of things and

mayBeAsyncChunkArguments(args[0].elements) && isModulesList(args[0].elements[1])

should make us confident that it is indeed a module.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Gongregcommented, May 18, 2020

For me from the history seems like it was simply added while working on chunks, and then more different scenarios were found and added on top as additional checks. So most likely left side can be skipped. I will make a pr without it.

0reactions
valscioncommented, May 18, 2020

I don’t really know why we need to be so strict in checking the left-hand side here. Maybe if all the tests pass with the left-side check being more relaxed or removed altogether is good enough?

Does @th0r have any insight on why the left-hand side expression check has been there?

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack-bundle-analyzer
isAsyncChunkPushExpression is checking for left side which cannot be easily determined. pjlee11 ... Parsed/gzip analysis missing majority of one bundle.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found