-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Stop using Babel; compile JS to ES2020 #4066
base: main
Are you sure you want to change the base?
Conversation
@schloerke can we get rid of this directory now? |
@@ -79,7 +75,7 @@ async function build( | |||
return esbuildBuild({ | |||
incremental: incremental, | |||
watch: watch, | |||
target: "es5", | |||
target: "es2020", |
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.
Notes:
- esbuild's
target
does not polyfill the JavaScript input files. It only adjust its javascript code.-
Automatic polyfill injection is outside of esbuild's scope.
-
- Matches tsconfig.json's
target
ofes2020
Given typescript is converting the code to es2020 and esbuild is compiling to es2020, we should be safe!
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.
Want to double check with @jcheng5 that es2020 is a good target to use for today.
I'd be happy to remove yarn in favor of npm during work week if there's interest!
There is! I'd be happy to pair with you and make the switch to |
I think it's time that we move on from using Babel and start using modern browser features natively.
My understanding is that Babel is for compiling code to ES2015, which is now 9 years old. This PR changes it to ES2020, which is 4 years old, but still has a lot of useful features that are expected these days, like
async
.The use of more modern generated code also will make debugging much easier, especially with async code.
As a result of these changes, the generated code will shrunk quite a bit. Notably, shiny.min.js goes from 438201 to 125209 bytes.