-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(utils): Use globalThis
#11351
feat(utils): Use globalThis
#11351
Conversation
Bundle ReportChanges will decrease total bundle size by 71.33kB ⬇️
|
size-limit report 📦
|
I think this is a good idea, but I'm a little scared about edge cases that we will encounter if we are less defensive of how we access the global in the browser environment. Does that fear seem reasonable? |
I don't think this is any riskier than the changes to target ES20xx. Every browser we support has supported it since at least late 2019 and for older browsers it's easy to polyfill. The MDN docs say:
What sort of edge cases are you thinking about? |
breaking react native, web workers, or extension context, but you know what - doing more reading I think we are fine. Let's merge! |
Now we've dropped Nove v12 we can simplify to `globalThis`: getsentry#5611 (comment)
Since v8, all platforms and versions we support have support for `globalThis`. Since [this PR](#11351) we also use `globalThis` when reading these injectected values.
Now we've dropped Node v12 we can simplify to
globalThis
:#5611 (comment)