@esbuild/linux-riscv64
Advanced tools
Changelog
0.18.11
Fix a TypeScript code generation edge case (#3199)
This release fixes a regression in version 0.18.4 where using a TypeScript namespace
that exports a class
declaration combined with --keep-names
and a --target
of es2021
or earlier could cause esbuild to export the class from the namespace using an incorrect name (notice the assignment to X2._Y
vs. X2.Y
):
// Original code
// Old output (with --keep-names --target=es2021)
var X;
((X2) => {
const _Y = class _Y {
};
__name(_Y, "Y");
let Y = _Y;
X2._Y = _Y;
})(X || (X = {}));
// New output (with --keep-names --target=es2021)
var X;
((X2) => {
const _Y = class _Y {
};
__name(_Y, "Y");
let Y = _Y;
X2.Y = _Y;
})(X || (X = {}));
Changelog
0.18.10
Fix a tree-shaking bug that removed side effects (#3195)
This fixes a regression in version 0.18.4 where combining --minify-syntax
with --keep-names
could cause expressions with side effects after a function declaration to be considered side-effect free for tree shaking purposes. The reason was because --keep-names
generates an expression statement containing a call to a helper function after the function declaration with a special flag that makes the function call able to be tree shaken, and then --minify-syntax
could potentially merge that expression statement with following expressions without clearing the flag. This release fixes the bug by clearing the flag when merging expression statements together.
Fix an incorrect warning about CSS nesting (#3197)
A warning is currently generated when transforming nested CSS to a browser that doesn't support :is()
because transformed nested CSS may need to use that feature to represent nesting. This was previously always triggered when an at-rule was encountered in a declaration context. Typically the only case you would encounter this is when using CSS nesting within a selector rule. However, there is a case where that's not true: when using a margin at-rule such as @top-left
within @page
. This release avoids incorrectly generating a warning in this case by checking that the at-rule is within a selector rule before generating a warning.
Changelog
0.18.6
Fix tree-shaking of classes with decorators (#3164)
This release fixes a bug where esbuild incorrectly allowed tree-shaking on classes with decorators. Each decorator is a function call, so classes with decorators must never be tree-shaken. This bug was a regression that was unintentionally introduced in version 0.18.2 by the change that enabled tree-shaking of lowered private fields. Previously decorators were always lowered, and esbuild always considered the automatically-generated decorator code to be a side effect. But this is no longer the case now that esbuild analyzes side effects using the AST before lowering takes place. This bug was fixed by considering any decorator a side effect.
Fix a minification bug involving function expressions (#3125)
When minification is enabled, esbuild does limited inlining of const
symbols at the top of a scope. This release fixes a bug where inlineable symbols were incorrectly removed assuming that they were inlined. They may not be inlined in cases where they were referenced by earlier constants in the body of a function expression. The declarations involved in these edge cases are now kept instead of being removed:
// Original code
{
const fn = () => foo
const foo = 123
console.log(fn)
}
// Old output (with --minify-syntax)
console.log((() => foo)());
// New output (with --minify-syntax)
{
const fn = () => foo, foo = 123;
console.log(fn);
}