-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(build)!: Drop pre-ES2020 polyfills #14882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
size-limit report 📦
|
We already have an eslint rule to avoid class fields, but had exceptions for static fields as well as for arrow functions. This also leads to bundle size increases, so removing the exceptions and handling the (few) exceptions we have there should save some bytes. Additionally, this has additional challenges if we want to avoid/reduce polyfills, as class fields need to be polyfilled for ES2020, sadly. Found as part of #14882
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question: Should we to adjust the makeSucrasePlugin
call in bundleHelpers.,js
as well?
@@ -144,7 +146,8 @@ | |||
"resolutions": { | |||
"gauge/strip-ansi": "6.0.1", | |||
"wide-align/string-width": "4.2.3", | |||
"cliui/wrap-ansi": "7.0.0" | |||
"cliui/wrap-ansi": "7.0.0", | |||
"**/sucrase": "getsentry/sucrase#es2020-polyfills" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta admit, I had no idea that one can simply specify a repo/branch name here. Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it required us to ensure that the dist folder is actually checked in on that branch, but IMHO this appears easier than to publish stuff from there etc 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for sure!
It should be the same now in all places, as we just generally set this option always? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be the same now in all places, as we just generally set this option always
Oh right, missed that, sorry! Let's then!
This PR updates to use a forked version of sucrase (https://github.com/getsentry/sucrase/tree/es2020-polyfills).
On this branch, a new option
disableES2019Transforms
is added, which can be used to only polyfill ES2020 features:10_000
)class X { field; }
)It also adds a lint step that checks all build output for ES2020 compatibility, to avoid regressions in this regard.