Hey thanks for the plugin, it's so useful !
I recently updated to v56 and was surprised about one suggestion. It's very common to have
const isServer = typeof window === 'undefined';
const isBrowser = typeof window !== 'undefined'
With prefer-global this
const isServer = typeof globalThis === 'undefined';
const isBrowser = typeof globalThis !== 'undefined';
I'm not totally sure the behaviour is correct and how it would be safe if the global context is "polluted"
Interested to know your advices.
PS:
I've also stumbled upon a different solution on so: https://stackoverflow.com/a/73261796/5490184
const isBrowser = Object.getPrototypeOf(
Object.getPrototypeOf(globalThis)
) !== Object.prototype
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too