-
Fix the
alias
feature to always prefer the longest match (#2963)It's possible to configure conflicting aliases such as
--alias:a=b
and--alias:a/c=d
, which is ambiguous for the import patha/c/x
(since it could map to eitherb/c/x
ord/x
). Previously esbuild would pick the first matchingalias
, which would non-deterministically pick between one of the possible matches. This release fixes esbuild to always deterministically pick the longest possible match. -
Minify calls to some global primitive constructors (#2962)
With this release, esbuild's minifier now replaces calls to
Boolean
/Number
/String
/BigInt
with equivalent shorter code when relevant:// Original code console.log( Boolean(a ? (b | c) !== 0 : (c & d) !== 0), Number(e ? '1' : '2'), String(e ? '1' : '2'), BigInt(e ? 1n : 2n), ) // Old output (with --minify) console.log(Boolean(a?(b|c)!==0:(c&d)!==0),Number(e?"1":"2"),String(e?"1":"2"),BigInt(e?1n:2n)); // New output (with --minify) console.log(!!(a?b|c:c&d),+(e?"1":"2"),e?"1":"2",e?1n:2n);
-
Adjust some feature compatibility tables for node (#2940)
This release makes the following adjustments to esbuild's internal feature compatibility tables for node, which tell esbuild which versions of node are known to support all aspects of that feature:
class-private-brand-checks
: node v16.9+ => node v16.4+ (a decrease)hashbang
: node v12.0+ => node v12.5+ (an increase)optional-chain
: node v16.9+ => node v16.1+ (a decrease)template-literal
: node v4+ => node v10+ (an increase)
Each of these adjustments was identified by comparing against data from the
node-compat-table
package and was manually verified using old node executables downloaded from https://nodejs.org/download/release/.