Skip to content

Commit

Permalink
fix #2060: undo the V8 object spread special case
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jun 18, 2022
1 parent 8ff05e1 commit 0d4fae1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

## Unreleased

* 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))
* 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))

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.

Expand Down Expand Up @@ -78,6 +78,8 @@
* `inset-property`
* `nesting`

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.

_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._

* Allow `define` to match optional chain expressions ([#2324](https://github.com/evanw/esbuild/issues/2324))
Expand Down
3 changes: 3 additions & 0 deletions internal/compat/js_table.go
Expand Up @@ -557,9 +557,12 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Safari: {{start: v{10, 0, 0}}},
},
ObjectRestSpread: {
Chrome: {{start: v{60, 0, 0}}},
Edge: {{start: v{79, 0, 0}}},
ES: {{start: v{2018, 0, 0}}},
Firefox: {{start: v{55, 0, 0}}},
IOS: {{start: v{11, 3, 0}}},
Node: {{start: v{8, 3, 0}}},
Opera: {{start: v{47, 0, 0}}},
Safari: {{start: v{11, 1, 0}}},
},
Expand Down
7 changes: 0 additions & 7 deletions scripts/compat-table.js
Expand Up @@ -326,13 +326,6 @@ for (const test of [...es5.tests, ...es6.tests, ...stage4.tests, ...stage1to3.te
}
}

// Work around V8-specific issues
for (const v8 of ['chrome', 'edge', 'node']) {
// Always lower object rest and spread for V8-based JavaScript VMs because of
// a severe performance issue: https://bugs.chromium.org/p/v8/issues/detail?id=11536
delete versions.ObjectRestSpread[v8]
}

for (const feature in features) {
if (!features[feature].found) {
throw new Error(`Did not find ${feature}`)
Expand Down

0 comments on commit 0d4fae1

Please sign in to comment.