esbuild 0.12.9
-
Allow
thiswith--define(#1361)You can now override the default value of top-level
thiswith the--definefeature. Top-levelthisdefaults to beingundefinedin ECMAScript modules andexportsin CommonJS modules. For example:// Original code ((obj) => { ... })(this); // Output with "--define:this=window" ((obj) => { ... })(window);Note that overriding what top-level
thisis will likely break code that uses it correctly. So this new feature is only useful in certain cases. -
Fix CSS minification issue with
!importantand duplicate declarations (#1372)Previously CSS with duplicate declarations for the same property where the first one was marked with
!importantwas sometimes minified incorrectly. For example:.selector { padding: 10px !important; padding: 0; }This was incorrectly minified as
.selector{padding:0}. The bug affected three properties:padding,margin, andborder-radius. With this release, this code will now be minified as.selector{padding:10px!important;padding:0}instead which means there is no longer a difference between minified and non-minified code in this case.