| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | < 17 hours ago | 3.4 kB | |
| v0.27.1 source code.tar.gz | < 17 hours ago | 2.0 MB | |
| v0.27.1 source code.zip | < 17 hours ago | 2.1 MB | |
| Totals: 3 Items | 4.1 MB | 0 | |
-
Fix bundler bug with
varnested insideif(#4348)This release fixes a bug with the bundler that happens when importing an ES module using
require(which causes it to be wrapped) and there's a top-levelvarinside anifstatement without being wrapped in a{ ... }block (and a few other conditions). The bundling transform needed to hoist thesevardeclarations outside of the lazy ES module wrapper for correctness. See the issue for details. -
Fix minifier bug with
forinsidetryinside label (#4351)This fixes an old regression from version v0.21.4. Some code was introduced to move the label inside the
trystatement to address a problem with transforming labeledfor awaitloops to avoid theawait(the transformation involves converting thefor awaitloop into aforloop and wrapping it in atrystatement). However, it introduces problems for cross-compiled JVM code that uses all three of these features heavily. This release restricts this transform to only apply toforloops that esbuild itself generates internally as part of thefor awaittransform. Here is an example of some affected code:```js // Original code d: { e: { try { while (1) { break d } } catch { break e; } } }
// Old output (with --minify) a:try{e:for(;;)break a}catch{break e}
// New output (with --minify) a:e:try{for(;;)break a}catch{break e} ```
-
Inline IIFEs containing a single expression (#4354)
Previously inlining of IIFEs (immediately-invoked function expressions) only worked if the body contained a single
returnstatement. Now it should also work if the body contains a single expression statement instead:```js // Original code const foo = () => { const cb = () => { console.log(x()) } return cb() }
// Old output (with --minify) const foo=()=>(()=>{console.log(x())})();
// New output (with --minify) const foo=()=>{console.log(x())}; ```
-
The minifier now strips empty
finallyclauses (#4353)This improvement means that
finallyclauses containing dead code can potentially cause the associatedtrystatement to be removed from the output entirely in minified builds:```js // Original code function foo(callback) { if (DEBUG) stack.push(callback.name); try { callback(); } finally { if (DEBUG) stack.pop(); } }
// Old output (with --minify --define:DEBUG=false) function foo(a){try{a()}finally{}}
// New output (with --minify --define:DEBUG=false) function foo(a){a()} ```
-
Allow tree-shaking of the
SymbolconstructorWith this release, calling
Symbolis now considered to be side-effect free when the argument is known to be a primitive value. This means esbuild can now tree-shake module-level symbol variables:```js // Original code const a = Symbol('foo') const b = Symbol(bar)
// Old output (with --tree-shaking=true) const a = Symbol("foo"); const b = Symbol(bar);
// New output (with --tree-shaking=true) const b = Symbol(bar); ```