-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isAsyncChunkPushExpression is checking for left side which cannot be easily determined #350
Comments
We cannot check left part because it can be dynamically set with custom globalObject: "(typeof self !== 'undefined' ? self : this)", Or we could check the left side and allow |
Thanks for opening the issue! It's a bit hard to understand because I don't immediately get to the same level of context as you have. Would you be able to explain what kind of webpack configuration outputs the bundle you are seeing, and then we could figure out what code needs to be changed and how? Thanks |
Hello :) Yes. In this case all you have to do is manually change |
I take it that this is the crux of this issue and that this situation happens when In that case, we'd appreciate a PR with a test case covering this, and even happier we'd be if we could have a fix, too 😄. I wrote some instructions in another issue recently on how to go about doing this kind of code change, see here: #347 (comment) Feel free to do some code changes and then we can discuss the approaches when we have running code and CI is running the tests |
Of course I will make a PR/add test case :) There is one additional case that is not covered by this module parser (async web worker chunks which are not using .push for modules, but I am investigating it at the moment, trying to understand when it happens). Will report/pr it when I find it. |
Thanks! As long as there's an additional test case, and code isn't hugely refactored in the same PR as a fix is done in, it should be a no-brainer for us to get the fixes merged Larger refactors would be nicer if they would be done in their own PR outside of the fixes themselves, if at all possible. This way us maintainers won't have to figure out the potential impact of refactoring together with fixes to some scenarios. So even if the fixes would make the code look even worse (adding more branches to the conditionals), I'd be grateful if such a PR was first done and then once that is merged in, a refactor PR in its own would be nice |
Would you be more for adding additional |
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? |
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. |
Issue description
webpack-bundle-analyzer/src/parseUtils.js
Lines 191 to 214 in 757c12e
These lines
webpack-bundle-analyzer/src/parseUtils.js
Lines 201 to 208 in 757c12e
Are checking if .push is called on
window
,self
orthis
.So for the simple cases:
it works well.
But sometimes Webpack creates left side output which can be
MemberExpression
:I am thinking is there any need for checking of the left side? We are already checking a lot of things and
should make us confident that it is indeed a module.
The text was updated successfully, but these errors were encountered: