Skip to content

Commit 0d4fae1

Browse files
committed
fix #2060: undo the V8 object spread special case
1 parent 8ff05e1 commit 0d4fae1

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Unreleased
44

5-
* Add the ability to override support for individual syntax features ([2290](https://github.com/evanw/esbuild/issues/2290), [#2308](https://github.com/evanw/esbuild/issues/2308), [#2060](https://github.com/evanw/esbuild/issues/2060))
5+
* Add the ability to override support for individual syntax features ([#2060](https://github.com/evanw/esbuild/issues/2060), [#2290](https://github.com/evanw/esbuild/issues/2290), [#2308](https://github.com/evanw/esbuild/issues/2308))
66

77
The `target` setting already lets you configure esbuild to restrict its output by only making use of syntax features that are known to be supported in the configured target environment. For example, setting `target` to `chrome50` causes esbuild to automatically transform optional chain expressions into the equivalent older JavaScript and prevents you from using BigInts, among many other things. However, sometimes you may want to customize this set of unsupported syntax features at the individual feature level.
88

@@ -78,6 +78,8 @@
7878
* `inset-property`
7979
* `nesting`
8080

81+
Since you can now specify `--supported:object-rest-spread=false` yourself to work around the V8 performance issue mentioned above, esbuild will no longer automatically transform all instances of object spread when targeting a V8-based JavaScript runtime going forward.
82+
8183
_Note that JavaScript feature transformation is very complex and allowing full customization of the set of supported syntax features could cause bugs in esbuild due to new interactions between multiple features that were never possible before. Consider this to be an experimental feature._
8284

8385
* Allow `define` to match optional chain expressions ([#2324](https://github.com/evanw/esbuild/issues/2324))

internal/compat/js_table.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,12 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
557557
Safari: {{start: v{10, 0, 0}}},
558558
},
559559
ObjectRestSpread: {
560+
Chrome: {{start: v{60, 0, 0}}},
561+
Edge: {{start: v{79, 0, 0}}},
560562
ES: {{start: v{2018, 0, 0}}},
561563
Firefox: {{start: v{55, 0, 0}}},
562564
IOS: {{start: v{11, 3, 0}}},
565+
Node: {{start: v{8, 3, 0}}},
563566
Opera: {{start: v{47, 0, 0}}},
564567
Safari: {{start: v{11, 1, 0}}},
565568
},

scripts/compat-table.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,6 @@ for (const test of [...es5.tests, ...es6.tests, ...stage4.tests, ...stage1to3.te
326326
}
327327
}
328328

329-
// Work around V8-specific issues
330-
for (const v8 of ['chrome', 'edge', 'node']) {
331-
// Always lower object rest and spread for V8-based JavaScript VMs because of
332-
// a severe performance issue: https://bugs.chromium.org/p/v8/issues/detail?id=11536
333-
delete versions.ObjectRestSpread[v8]
334-
}
335-
336329
for (const feature in features) {
337330
if (!features[feature].found) {
338331
throw new Error(`Did not find ${feature}`)

0 commit comments

Comments
 (0)