Wildhoney / ReactShadow

:beginner: Utilise Shadow DOM in React with all the benefits of style encapsulation.
https://react-shadow.herokuapp.com/
MIT License
1.29k stars 80 forks source link

global requires a polyfill. Shall we replace global with globalThis? #129

Open brendonjohn opened 2 years ago

brendonjohn commented 2 years ago

Hey there, I love the library.

From testing a library in stripped-down environments I've realised react-shadow assumes that global is available for accessing the global this value.

Do you have a suggested polyfill for making global available?

Alternatively, would you accept a PR to replace the use of global with globalThis? I'm happy to send the PR through.

image

https://caniuse.com/mdn-javascript_builtins_globalthis

This should be significantly better without needing to make an invasive change.

🙇

brendonjohn commented 2 years ago

I see this has been resolved here: https://github.com/Wildhoney/ReactShadow/pull/121

jclhandy commented 2 years ago

I think is a great experience