esbuild 0.11.20
-
Omit warning about duplicate JSON keys from inside
node_modules(#1254)This release no longer warns about duplicate keys inside
package.jsonfiles insidenode_modules. There are packages like this that are published to npm, and this warning is unactionable. Now esbuild will only issue this warning outside ofnode_modulesdirectories. -
Add CSS minification for
box-shadowvaluesThe CSS
box-shadowproperty is now minified when--mangle-syntaxis enabled. This includes trimming length values and minifying color representations. -
Fix object spread transform for non-spread getters (#1259)
When transforming an object literal containing object spread (the
...syntax), properties inside the spread should be evaluated but properties outside the spread should not be evaluated. Previously esbuild's object spread transform incorrectly evaluated properties in both cases. Consider this example:var obj = { ...{ get x() { console.log(1) } }, get y() { console.log(3) }, } console.log(2) obj.yThis should print out
1 2 3because the non-spread getter should not be evaluated. Instead, esbuild was incorrectly transforming this into code that printed1 3 2. This issue should now be fixed with this release. -
Prevent private class members from being added more than once
This fixes a corner case with the private class member implementation. Constructors in JavaScript can return an object other than
this, so private class members can actually be added to objects other thanthis. This can be abused to attach completely private metadata to other objects:class Base { constructor(x) { return x } } class Derived extends Base { #y static is(z) { return #y in z } } const foo = {} new Derived(foo) console.log(Derived.is(foo)) // trueThis already worked in code transformed by esbuild for older browsers. However, calling
new Derived(foo)multiple times in the above code was incorrectly allowed. This should not be allowed because it would mean that the private field#ywould be re-declared. This is no longer allowed starting from this release.