Skip to content
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

Allow self for globalObject in async chunks #323

Merged
merged 1 commit into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ _Note: Gaps between patch versions are faulty, broken or test releases._

<!-- Add changelog entries for new changes under this section -->

* **Improvement**
* Support webpack builds where `output.globalObject` is set to `'self'` ([#323](https://github.com/webpack-contrib/webpack-bundle-analyzer/pull/323) by [@lemonmade](https://github.com/lemonmade))

## 3.5.2

* **Bug Fix**
Expand Down
2 changes: 2 additions & 0 deletions src/parseUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ function isAsyncChunkPushExpression(node) {
callee.object.left.object &&
(
callee.object.left.object.name === 'window' ||
// `self` is a common output.globalObject value used to support both workers and browsers
callee.object.left.object.name === 'self' ||
// Webpack 4 uses `this` instead of `window`
callee.object.left.object.type === 'ThisExpression'
) &&
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(self.webpackJsonp=self.webpackJsonp||[]).push([[27],{1:function(e,n,t){console.log("Chuck Norris")}}]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"modules": {
"1": "function(e,n,t){console.log(\"Chuck Norris\")}"
}
}