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.

ESbuild lags behind (non-trivially) in producing gzip friendly output for large pacakges

See original GitHub issue

Thanks for publishing these benchmarks. I’m the author of bundlephobia (a tool developers use to find out minified and minzipped sizes of npm packages) and was contemplating on replacing Terser with ESBuild’s minifier to shave a few seconds from build.

Seeing this benchmark, I got the picture that ESBuild and Terser and neck to neck. However, this doesn’t seem to be the case for large packages. While the minified size might still be comparable in some cases, the gzipped size difference between esbuild and terser can vary between 5%-9% — which one might consider non-trivial difference for minification.

Benchmarks after replacing Terser with ESBuild in Bundlephobia’s webpack config, and after manually extracting out license-style comments —

Package Minified Terser Minified ESBuild Minzip Terser Minzip ESBuild
webpack 2.48 MB 2.52 MB (+2%) 650KB 683 KB (+5%)
echarts 957 KB 975 KB (+2%) 304KB 316 KB (+4%)
antd 1.16 MB 1.27MB (+9%) 345 KB 370 KB (+7%)
victory (charts) 518 KB 532 KB (+3%) 130KB 140 KB (+8%)

The results remain the same whether running esbuild minify through esbuild-loader or the ESBuild CLI on the webpack built bundle.

Is there anyway to capture this on the current page?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kzccommented, Apr 10, 2021

https://unpkg.com/victory@35.4.13/dist/victory.js is rather odd. Every bundled module is an eval’ed string block of webpack requires:

/******/ ({

/***/ "../../../node_modules/d3-array/src/array.js":
/*!******************************************************************************!*\
  !*** /Users/boygirl/formidable/v/victory/node_modules/d3-array/src/array.js ***!
  \******************************************************************************/
/*! exports provided: slice, map */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"slice\", function() { return slice; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"map\", function() { return map; });\nvar array = Array.prototype;\n\nvar slice = array.slice;\nvar map = array.map;\n\n\n//# sourceURL=webpack://Victory//Users/boygirl/formidable/v/victory/node_modules/d3-array/src/array.js?");

/***/ }),

Perhaps it was produced with webpack’s debug or development mode. While it can be (poorly) minified, I don’t think it is representative of how typical production libraries or applications are bundled and probably should not be included in the benchmark.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove unused pure functions and variables #639 - GitHub
ESbuild lags behind (non-trivially) in producing gzip friendly output for large pacakges privatenumber/minification-benchmarks#10.
Read more >
FAQ - ESBuild
I used the @rollup/plugin-terser plugin because Rollup itself doesn't support minification. Webpack 5 uses --mode=production --devtool=sourcemap . Parcel 2 uses ...
Read more >
ESbuild – A fast JavaScript bundler and minifier in Go
I'm trying to create a build tool that a) works well for a given sweet spot of use cases (bundling JavaScript, TypeScript, and...
Read more >
@netlify/esbuild-windows-64 | Yarn - Package Manager
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. ... These annotations are passed through into the output by...
Read more >
bundlejs: An online esbuild based bundler & npm bundle size ...
The manual for bundlejs, with tips & tricks for using it, and an explanation of how it works (esbuild-wasm, gzip/brotli compression, ...
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