You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,49 @@
1
1
# Changelog
2
2
3
+
## Unreleased
4
+
5
+
* Fix minifier correctness bug with single-use substitutions ([#2619](https://github.com/evanw/esbuild/issues/2619))
6
+
7
+
When minification is enabled, esbuild will attempt to eliminate variables that are only used once in certain cases. For example, esbuild minifies this code:
However, this transformation had a bug where esbuild did not correctly consider the "read" part of binary read-modify-write assignment operators. For example, it's incorrect to minify the following code into `bar +=fn()` because the call to `fn()` might modify `bar`:
25
+
26
+
```js
27
+
constfoo=fn();
28
+
bar += foo;
29
+
```
30
+
31
+
In addition to fixing this correctness bug, this release also improves esbuild's output in the case where all values being skipped over are primitives:
32
+
33
+
```js
34
+
functiontoneMapLuminance(r, g, b) {
35
+
let hdr =luminance(r, g, b)
36
+
let decay =1/ (1+ hdr)
37
+
return1- decay
38
+
}
39
+
```
40
+
41
+
Previous releases of esbuild didn't substitute these single-use variables here, but esbuild will now minify this to the following code starting with this release:
0 commit comments