release notes
An extremely fast bundler for the web
release notes
Published 8/8/2022
PatchSafe upgraderelease notes
Published 8/8/2022
PatchSafe upgradeFix optimizations for calls containing spread arguments (#2445)
This release fixes the handling of spread arguments in the optimization of /* @__PURE__ */ comments, empty functions, and identity functions:
// Original code
function empty() {}
function identity(x) { return x }
/* @__PURE__ */ a(...x)
/* @__PURE__ */ new b(...x)
empty(...x)
identity(...x)
// Old output (with --minify --tree-shaking=true)
...x;...x;...x;...x;
// New output (with --minify --tree-shaking=true)
function identity(n){return n}[...x];[...x];[...x];identity(...x);
Previously esbuild assumed arguments with side effects could be directly inlined. This is almost always true except for spread arguments, which are not syntactically valid on their own and which have the side effect of causing iteration, which might have further side effects. Now esbuild will wrap these elements in an unused array so that they are syntactically valid and so that the iteration side effects are preserved.
Fix optimizations for calls containing spread arguments (#2445)
This release fixes the handling of spread arguments in the optimization of /* @__PURE__ */ comments, empty functions, and identity functions:
// Original code
function empty() {}
function identity(x) { return x }
/* @__PURE__ */ a(...x)
/* @__PURE__ */ new b(...x)
empty(...x)
identity(...x)
// Old output (with --minify --tree-shaking=true)
...x;...x;...x;...x;
// New output (with --minify --tree-shaking=true)
function identity(n){return n}[...x];[...x];[...x];identity(...x);
Previously esbuild assumed arguments with side effects could be directly inlined. This is almost always true except for spread arguments, which are not syntactically valid on their own and which have the side effect of causing iteration, which might have further side effects. Now esbuild will wrap these elements in an unused array so that they are syntactically valid and so that the iteration side effects are preserved.