-
Fix a minification bug with a double-nested
if
inside a label followed byelse
(#2139)This fixes a minification bug that affects the edge case where
if
is followed byelse
and theif
contains a label that contains a nestedif
. Normally esbuild's AST printer automatically wraps the body of a single-statementif
in braces to avoid the "dangling else"if
/else
ambiguity common to C-like languages (where theelse
accidentally becomes associated with the innerif
instead of the outerif
). However, I was missing automatic wrapping of label statements, which did not have test coverage because they are a rarely-used feature. This release fixes the bug:// Original code if (a) b: { if (c) break b } else if (d) e() // Old output (with --minify) if(a)e:if(c)break e;else d&&e(); // New output (with --minify) if(a){e:if(c)break e}else d&&e();
-
Fix edge case regarding
baseUrl
andpaths
intsconfig.json
(#2119)In
tsconfig.json
, TypeScript forbids non-relative values insidepaths
ifbaseUrl
is not present, and esbuild does too. However, TypeScript checked this after the entiretsconfig.json
hierarchy was parsed while esbuild incorrectly checked this immediately when parsing the file containing thepaths
map. This caused incorrect warnings to be generated fortsconfig.json
files that specify abaseUrl
value and that inherit apaths
value from anextends
clause. Now esbuild will only check for non-relativepaths
values after the entire hierarchy has been parsed to avoid generating incorrect warnings. -
Better handle errors where the esbuild binary executable is corrupted or missing (#2129)
If the esbuild binary executable is corrupted or missing, previously there was one situation where esbuild's JavaScript API could hang instead of generating an error. This release changes esbuild's library code to generate an error instead in this case.