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

Is it time to move to ES2017 and how #4045

Closed
zhangyiatmicrosoft opened this issue Apr 26, 2024 · 4 comments
Closed

Is it time to move to ES2017 and how #4045

zhangyiatmicrosoft opened this issue Apr 26, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@zhangyiatmicrosoft
Copy link
Contributor

zhangyiatmicrosoft commented Apr 26, 2024

User Story

MapLibre currently compiles to ES2016 version, and maybe should upgrade to ES2017; the most important benefit would be the native support of async/await.

99% of browsers should have ES2017 support, see more: https://caniuse.com/?search=ES2017

When it comes to how, there could be two options, and both are pretty straight forward.

  1. Modify tsconfig and be done. One line change.
  2. A new tsconfig can be added, and with minor build script tweaking, both es2016 and es2017 or any newer version can be built at same time so app developers can choose whichever they want to use in their app. This maintains maximum backward compatibility and more friendly for the community in general.

Rationale

  • Much more pleasant debugging experience when source map is unavailable in various hosting apps, because async/await statements will not be converted to TS helpers, which are quite verbose and confusing.
  • Smaller script (~3kb reduction), negligible for end consumers but every bit counts. :)
@HarelM
Copy link
Member

HarelM commented Apr 26, 2024

Check out the following discussion:
#3210
The end result of it was to downgrade to es2016.
I think the way forward would be to use esm build with modern es20xx keep that running in parallel for a few versions and then drop the support for old style commonjs.
IDK...

@HarelM HarelM added the enhancement New feature or request label Apr 26, 2024
@HarelM
Copy link
Member

HarelM commented Apr 27, 2024

It's also worth noting that it seems angular did make an effort to fix the issue, but I don't think it will be available soon enough:
angular/angular-cli#22191 (comment)

@birkskyum
Copy link
Member

birkskyum commented Apr 27, 2024

When Angular developers have a path forward supporting async/await, then we can move too - can't really do it before. I don't know if that is Angular 18 (might be), and if it'll be trivial enough for angular devs to migrate to angular 18 for us to say "just upgrade Angular and it'll work again".

Regarding ESM, another cool thing here is that Node 22 actually allow to require(esm), so it'll hopefully ease some of the cjs/esm friction, maybe not for maplibre, but in general.

@zhangyiatmicrosoft
Copy link
Contributor Author

Closing it for now. Does not look like it is happening for the next several months.

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

No branches or pull requests

3 participants