Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Stop using Babel; compile JS to ES2020 #4066

wants to merge 2 commits into from

Conversation

wch
Copy link
Collaborator

@wch wch commented May 24, 2024

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.

❯ git diff --stat
 inst/www/shared/busy-indicators/busy-indicators.css                     |   2 +-
 inst/www/shared/datepicker/js/bootstrap-datepicker.min.js               | Bin 106348 -> 105799 bytes
 inst/www/shared/ionrangeslider/js/ion.rangeSlider.min.js                | Bin 41631 -> 41610 bytes
 inst/www/shared/selectize/accessibility/js/selectize-plugin-a11y.min.js | Bin 2512 -> 2503 bytes
 inst/www/shared/shiny-autoreload.js                                     | Bin 59336 -> 891 bytes
 inst/www/shared/shiny-autoreload.js.map                                 | Bin 314216 -> 3824 bytes
 inst/www/shared/shiny-showcase.css                                      | Bin 1044 -> 1042 bytes
 inst/www/shared/shiny-showcase.js                                       | Bin 24731 -> 3479 bytes
 inst/www/shared/shiny-showcase.js.map                                   | Bin 126645 -> 14761 bytes
 inst/www/shared/shiny-testmode.js                                       | Bin 250 -> 242 bytes
 inst/www/shared/shiny-testmode.js.map                                   | Bin 1498 -> 1539 bytes
 inst/www/shared/shiny.js                                                | Bin 1045360 -> 245709 bytes
 inst/www/shared/shiny.js.map                                            | Bin 1788617 -> 701144 bytes
 inst/www/shared/shiny.min.css                                           | Bin 6311 -> 6309 bytes
 inst/www/shared/shiny.min.js                                            | Bin 438201 -> 125209 bytes
 inst/www/shared/shiny.min.js.map                                        | Bin 1828489 -> 703574 bytes
 yarn.lock                                                               |   2 +-
 17 files changed, 2 insertions(+), 2 deletions(-)

@wch
Copy link
Collaborator Author

wch commented May 24, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant