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.

Setting output.globalObject breaks parsed + gzip

See original GitHub issue

Issue description

config.output.globalObject = "(typeof self !== 'undefined' ? self : this)"

Breaks parsed + gzip sizes. Removing it fixed them.

Technical info

  • Webpack Bundle Analyzer version: 3.3.2
  • Webpack version: 4.35.0
  • Node.js version: 11.10.0
  • npm/yarn version: 6.7.0
  • OS: mac os x; windows

Expected Behavior

Gzip and parsed should contain data bout more than just the output files - the modules inside them as well.

Actual Behavior

Only stats includes all modules. Gzip and parsed just show large blocks for each bundle piece (output file)

Code

My default:

config.output.globalObject = "(typeof self !== 'undefined' ? self : this)"

When I analyze:

delete config.output.globalObject;

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
th0rcommented, Jul 5, 2019

But it won’t be evaluated as JS unless you put it in backticks?

This string is inserted in the generated code as-is - it should not be evaluated at compile time.

E.g. imagine this bundle template:

var global = {{ config.globalObject }};

Then resulting bundle will be:

var global = (typeof self !== 'undefined' ? self : this);
0reactions
valscioncommented, Jul 5, 2019

Oh wow, that wasn’t obvious at all from the webpack documentation. Thanks for explaining.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack-bundle-analyzer/CHANGELOG.md - UNPKG
84, * Support any custom `globalObject` option in Webpack Config. ... Those chunks just won't be visible in the report for parsed/gzipped sizes....
Read more >
webpack-bundle-analyzer | Yarn - Package Manager
Troubleshooting. I don't see gzip or parsed sizes, it only shows stat size. It happens when webpack-bundle-analyzer analyzes files that don't actually exist...
Read more >
Output - webpack
To make UMD build available on both browsers and Node.js, set output.globalObject option to 'this' . Defaults to self for Web-like targets.
Read more >
Node.js v19.3.0 Documentation
Contributing; Stability index; Stability overview; JSON output; System calls and man ... The --zero-fill-buffers command-line option; What makes Buffer.
Read more >
Safari Technology Preview Release Notes - Apple Developer
Note: Shared Tab Groups and syncing for Tab Groups, Website Settings, ... Relaxed Date parsing to accept narrow-no-break-space (256754@main) ...
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