v0.11.20
-
Omit warning about duplicate JSON keys from inside
node_modules
(#1254)This release no longer warns about duplicate keys inside
package.json
files 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_modules
directories. -
Add CSS minification for
box-shadow
valuesThe CSS
box-shadow
property is now minified when--mangle-syntax
is 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.y
This should print out
1 2 3
because 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)) // true
This 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#y
would be re-declared. This is no longer allowed starting from this release.