web-configs icon indicating copy to clipboard operation
web-configs copied to clipboard

[babel-preset] Allow customizing Babel assumptions and set loose~ish defaults

Open developit opened this issue 3 years ago • 0 comments

This adds support for customizing the assumptions configuration passed to @babel/preset-env, which is a granular replacement for Babel's previous "loose mode" functionality.

I've also included a set of default assumptions, with comments above each explaining what they do. Some of them are clear-cut "we would never rely on that" assumptions (document.all), others I've tried to infer from the TS+JS I've scanned through via cs.github.com.

The three I'm most concerned about would be objectRestNoSymbols, setSpreadProperties and superIsCallableConstructor. These all have good runtime performance payoff if we can land them by default - the normal "strict" helpers do extra iteration that the "loose" helpers can skip. If anyone believes Shopify might currently be relying on this functionality, we'd want to remove them.

developit avatar Sep 14 '22 15:09 developit