Skip to content

[v8] Drop support for ES5 #9829

Closed

Description

@mydea

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)

Activity

  1. added this to the 8.0.0 milestone on Dec 14, 2023
  2. AbhiPrasad commented on Dec 14, 2023

    @AbhiPrasad
    Contributor

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

  3. yonggwan commented on Feb 23, 2024

    @yonggwan

    please do not abandon ie11 😭

  4. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 23, 2024
  5. lforst commented on Feb 23, 2024

    @lforst
    Contributor

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

  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Feb 23, 2024
  7. self-assigned this
    on Mar 4, 2024
  8. timfish commented on Mar 13, 2024

    @timfish
    Collaborator

    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.

  9. s1gr1d commented on Mar 13, 2024

    @s1gr1d
    Member

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

  10. timfish commented on Mar 13, 2024

    @timfish
    Collaborator

    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?

  11. mydea commented on Mar 13, 2024

    @mydea
    MemberAuthor

    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?

  12. AbhiPrasad commented on Mar 19, 2024

    @AbhiPrasad
    Contributor

    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
  13. s1gr1d commented on Mar 19, 2024

    @s1gr1d
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions