isAsyncChunkPushExpression is checking for left side which cannot be easily determined
See original GitHub issueIssue description
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:
- Created 3 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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?