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

[v8] Drop support for ES5 #9829

Closed
Tracked by #9508
mydea opened this issue Dec 14, 2023 · 9 comments · Fixed by #11201
Closed
Tracked by #9508

[v8] Drop support for ES5 #9829

mydea opened this issue Dec 14, 2023 · 9 comments · Fixed by #11201
Assignees
Milestone

Comments

@mydea
Copy link
Member

mydea commented Dec 14, 2023

Currently, we emit JS (both in the CDN bundles, as well as in the npm packages) that is ES5 (down to IE11) compatible.

In v8, we want to stop emitting ES5, and instead emit newer JS standard.

I would propose to emit ES2017. You can see a decent overview of new features here: https://en.wikipedia.org/wiki/ECMAScript_version_history#ES2017

ES2017 includes:

  • basic ES6
  • async/await
  • [].includes()
  • Object.values(), Object.entires(), object.getOwnPropertyDescriptors()

ES2018 added Promise.finally, which is nice but not so important for us I'd say.
ES 2019 added [].flat / [].flatMap(), and Object.fromEntries() (which again is nice, but nothing we use too much).
ES2020 is nice because it adds nullish coalescing and globalThis, but it is pretty recent ("just" 3 years old...)

This means that in v8, we will not ship any polyfills for stuff below ES2017. If you still need to support older browsers, you need to polyfill/transpile the SDK yourself (which most bundlers will do anyhow for you).

Open questions

  • Should we target Es2017 or something else?
  • Should we continue to provide ES5 CDN bundles?
  • We started some work to have the loader detect ES6 support. Maybe we should revisit this and actually ship this? To avoid breaking loader users that still need ES5 support (for them, providing polyfills is harder than for npm users)
@mydea mydea added this to the 8.0.0 milestone Dec 14, 2023
@mydea mydea mentioned this issue Dec 14, 2023
@AbhiPrasad
Copy link
Member

I vote for es2017! Having Object.values, includes and async/await will improve the bundle size situation a ton in our codebase.

@yonggwan
Copy link

please do not abandon ie11 😭

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Feb 23, 2024
@lforst
Copy link
Member

lforst commented Feb 23, 2024

@yonggwan 🥲 how are you using Sentry? Via the CDN bundle or the npm package?

@timfish
Copy link
Collaborator

timfish commented Mar 13, 2024

ES2018 includes object rest/spread properties which our node targets support as does every browser released since 2018. This has to be a good enough reason to choose ES2018 over ES2017?

Optional chaining and nullish coalescing are ES2020 but Node v14.18 supports both of them so we can remove the polyfills entirely for @sentry/node.

@s1gr1d
Copy link
Member

s1gr1d commented Mar 13, 2024

@timfish Good point! We can base everything on ES2018 to also use the spread operator 👍🏻

@timfish
Copy link
Collaborator

timfish commented Mar 13, 2024

I just double checked this because I couldn't see any spread polyfills and...

"iterable spread" (ie. [...args]) was ES2015/ES6 and ES2018 adds "object spread/rest" (const {...rest} = {...spread}).

I guess if we didn't have polyfills we were leaving these down to typescript? Or they've already been deleted and I missed that?

@mydea
Copy link
Member Author

mydea commented Mar 13, 2024

I just double checked this because I couldn't see any spread polyfills and...

"iterable spread" (ie. [...args]) was ES2015/ES6 and ES2018 adds "object spread/rest" (const {...rest} = {...spread}).

I guess if we didn't have polyfills we were leaving these down to typescript? Or they've already been deleted and I missed that?

Maybe TS transpiles that based on the target, I'd say?

@AbhiPrasad
Copy link
Member

Update: after some discussion in slack we're going to make the default ES2018!

This makes the minimum browser versions now:

  • Chrome 63
  • Edge 79
  • Safari 12
  • Firefox 55
  • Opera 50
  • iOS Safari 12
  • Samsung Browser 8.2

@s1gr1d
Copy link
Member

s1gr1d commented Mar 19, 2024

Promise.prototype.finally (which is included in ES2018) is Firefox 58 :)

s1gr1d added a commit that referenced this issue Mar 22, 2024
c298lee pushed a commit that referenced this issue Mar 22, 2024
c298lee pushed a commit that referenced this issue Mar 23, 2024
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this issue Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants