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
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,35 @@
77
77
}
78
78
```
79
79
80
+
* Do additional constant folding after cross-module enum inlining ([#3416](https://github.com/evanw/esbuild/issues/3416), [#3425](https://github.com/evanw/esbuild/issues/3425))
81
+
82
+
This release adds a few more cases where esbuild does constant folding after cross-module enum inlining.
83
+
84
+
```ts
85
+
// Original code: enum.ts
86
+
export enum Platform {
87
+
WINDOWS = 'windows',
88
+
MACOS = 'macos',
89
+
LINUX = 'linux',
90
+
}
91
+
92
+
// Original code: main.ts
93
+
import { Platform } from './enum';
94
+
declare const PLATFORM: string;
95
+
export function logPlatform() {
96
+
if (PLATFORM == Platform.WINDOWS) console.log('Windows');
97
+
else if (PLATFORM == Platform.MACOS) console.log('macOS');
98
+
else if (PLATFORM == Platform.LINUX) console.log('Linux');
99
+
else console.log('Other');
100
+
}
101
+
102
+
// Old output (with --bundle '--define:PLATFORM="macos"' --minify --format=esm)
103
+
function n(){"windows"=="macos"?console.log("Windows"):"macos"=="macos"?console.log("macOS"):"linux"=="macos"?console.log("Linux"):console.log("Other")}export{n as logPlatform};
104
+
105
+
// New output (with --bundle '--define:PLATFORM="macos"' --minify --format=esm)
106
+
function n(){console.log("macOS")}export{n as logPlatform};
107
+
```
108
+
80
109
* Formatting support for the `@position-try` rule ([#3773](https://github.com/evanw/esbuild/issues/3773))
81
110
82
111
Chrome shipped this new CSS at-rule in version 125 as part of the [CSS anchor positioning API](https://developer.chrome.com/blog/anchor-positioning-api). With this release, esbuild now knows to expect a declaration list inside of the `@position-try` body block and will format it appropriately.
0 commit comments