esbuild 0.11.12
-
Fix a bug where
-0and0were 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-0is a different bit pattern than0and while they both compare equal, the difference is detectable in a few scenarios such as when usingObject.is(). The minification transformation now checks for-0vs.0and 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 functionstatement 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.Printis never called, and what appears to be a reference to thePrintsymbol on the namespaceSomethingis 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
debuglog level intodebugandverboseYou can now use
--log-level=debugto 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 thedebuglog level no longer generates a torrent of debug information like it did in the past; that behavior is now reserved for theverboselog level instead.