esbuild
0.28.2 · 8 Aug 2026MIT439.7M / weekRepositoryHomepagenpmAtom feed
0.28.2 is the newest release of 0.14.x.
In short
2 new1 fixed1 changed
Security
1 advisory affects 0.14.31
- Moderateesbuild enables any website to send any requests to the development server and read the responseGHSA-67mh-4wv8-2f99 · 10 Feb 2025No fix yet
Release note
Add support for parsing "optional variance annotations" from TypeScript 4.7
The upcoming version of TypeScript now lets you specify
inand/orouton certain type parameters (specifically only on a type alias, an interface declaration, or a class declaration). These modifiers control type parameter covariance and contravariance:type Provider<out T> = () => T; type Consumer<in T> = (x: T) => void; type Mapper<in T, out U> = (x: T) => U; type Processor<in out T> = (x: T) => T;
With this release, esbuild can now parse these new type parameter modifiers. This feature was contributed
Improve support for
super()constructor calls in nested locationsIn JavaScript, derived classes must call
super()somewhere in theconstructormethod before being able to accessthis. Class public instance fields, class private instance fields, and TypeScript constructor parameter properties can all potentially cause code which usesthisto be inserted into the constructor body, which must be inserted after thesuper()call. To make these insertions straightforward to implement, the TypeScript compiler doesn't allow callingsuper()somewhere other than in a root-level statement in the constructor body in these cases.Previously esbuild's class transformations only worked correctly when
super()was called in a root-level statement in the constructor body, just like the TypeScript compiler. But with this release, esbuild should now generate correct code as long as the call tosuper()appears anywhere in the constructor body:// Original code class Foo extends Bar { constructor(public skip = false) { if (skip) { super(null) return } super({ keys: [] }) } } // Old output (incorrect) class Foo extends Bar { constructor(skip = false) { if (skip) { super(null); return; } super({ keys: [] }); this.skip = skip; } } // New output (correct) class Foo extends Bar { constructor(skip = false) { var __super = (...args) => { super(...args); this.skip = skip; }; if (skip) { __super(null); return; } __super({ keys: [] }); } }Add support for the new
@containerCSS ruleThis release adds support for
@containerin CSS files. This means esbuild will now pretty-print and minify these rules better since it now better understands the internal structure of these rules:/* Original code */ @container (width <= 150px) { #inner { color: yellow; } } /* Old output (with --minify) */ @container (width <= 150px){#inner {color: yellow;}} /* New output (with --minify) */ @container (width <= 150px){#inner{color:#ff0}}This was contributed
Avoid CSS cascade-dependent keywords in the
font-familypropertyIn CSS,
initial,inherit, andunsetare CSS-wide keywords which means they have special behavior when they are specified as a property value. For example, whilefont-family: 'Arial'(as a string) andfont-family: Arial(as an identifier) are the same,font-family: 'inherit'(as a string) uses the font family namedinheritbutfont-family: inherit(as an identifier) inherits the font family from the parent element. This means esbuild must not unquote these CSS-wide keywords (anddefault, which is also reserved) during minification to avoid changing the meaning of the minified CSS.The current draft of the new CSS Cascading and Inheritance Level 5 specification adds another concept called cascade-dependent keywords of which there are two:
revertandrevert-layer. This release of esbuild guards against unquoting these additional keywords as well to avoid accidentally breaking pages that use a font with the same name:/* Original code */ a { font-family: 'revert'; } b { font-family: 'revert-layer', 'Segoe UI', serif; } /* Old output (with --minify) */ a{font-family:revert}b{font-family:revert-layer,Segoe UI,serif} /* New output (with --minify) */ a{font-family:"revert"}b{font-family:"revert-layer",Segoe UI,serif}This fix was contributed
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.