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

Improve portability of the UMD build #328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chocolateboy
Copy link

@chocolateboy chocolateboy commented Jul 31, 2021

This PR:

  • replaces self with globalThis
  • makes detection of CommonJS environments more robust

globalThis is the official way to refer to the global scope and is supported by almost all environments:

engine self globalThis
Node.js
QuickJS
SpiderMonkey
Modern browsers
Deno
IE11

The notable exception is IE11, which will need to use a polyfill. If IE11 support was previously promised or assumed, then this would be a breaking change.

@davidchambers
Copy link
Member

Thanks for the pull request, @chocolateboy! I pushed a few tweaks to your branch. Are you happy with them?

@chocolateboy
Copy link
Author

Yes, LGTM, thanks!

- replace `self` with `globalThis`
- make module detection more robust

Co-authored-by: David Chambers <dc@davidchambers.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants