v0.11.12
-
Fix a bug where
-0
and0
were collapsed to the same value (#1159)Previously esbuild would collapse
Object.is(x ? 0 : -0, -0)
intoObject.is((x, 0), -0)
during minification, which is incorrect. The IEEE floating-point value-0
is a different bit pattern than0
and while they both compare equal, the difference is detectable in a few scenarios such as when usingObject.is()
. The minification transformation now checks for-0
vs.0
and no longer has this bug. This fix was contributed by @rtsao. -
Match the TypeScript compiler's output in a strange edge case (#1158)
With this release, esbuild's TypeScript-to-JavaScript transform will no longer omit the namespace in this case:
namespace Something { export declare function Print(a: string): void } Something.Print = function(a) {}
This was previously omitted because TypeScript omits empty namespaces, and the namespace was considered empty because the
export declare function
statement isn't "real":namespace Something { export declare function Print(a: string): void setTimeout(() => Print('test')) } Something.Print = function(a) {}
The TypeScript compiler compiles the above code into the following:
var Something; (function (Something) { setTimeout(() => Print('test')); })(Something || (Something = {})); Something.Print = function (a) { };
Notice how
Something.Print
is never called, and what appears to be a reference to thePrint
symbol on the namespaceSomething
is actually a reference to the global variablePrint
. I can only assume this is a bug in TypeScript, but it's important to replicate this behavior inside esbuild for TypeScript compatibility.The TypeScript-to-JavaScript transform in esbuild has been updated to match the TypeScript compiler's output in both of these cases.
-
Separate the
debug
log level intodebug
andverbose
You can now use
--log-level=debug
to get some additional information that might indicate some problems with your build, but that has a high-enough false-positive rate that it isn't appropriate for warnings, which are on by default. Enabling thedebug
log level no longer generates a torrent of debug information like it did in the past; that behavior is now reserved for theverbose
log level instead.