fantasy-land icon indicating copy to clipboard operation
fantasy-land copied to clipboard

Improve portability of the UMD build

Open chocolateboy opened this issue 3 years ago • 2 comments

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.

chocolateboy avatar Jul 31 '21 18:07 chocolateboy

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

davidchambers avatar Aug 02 '21 13:08 davidchambers

Yes, LGTM, thanks!

chocolateboy avatar Aug 02 '21 13:08 chocolateboy