Wildhoney / ReactShadow

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

fix: change global to globalThis #121

Closed Sebastien-Ahkrin closed 2 years ago

Sebastien-Ahkrin commented 3 years ago

Hello everyone 👋

I think i have found a bug with the application if i'm not using any tool like Webpack. With Webpack we can use the application normaly and the "global" under it will work :

styleSheets: PropTypes.arrayOf(
    PropTypes.instanceOf(global),
)

But, if i'm using something else, like vite for example we cannot use the "global" variables ... So, i think we can use "globalThis" instead. It supported in most browser you can check the caniuse if wanted.

globalThis is supported the same as shadow dom.

Hope this will help you :) If you have any question, suggestion and other you can send to me a message here 👋

dixso commented 2 years ago

It works!

httpete commented 2 years ago

This does work - and is crucial for me to be able to use ReactShadow. Can this please get merged? We are using esbuild and I hit the same issue.

Wildhoney commented 2 years ago

Better late than never — merged and released as 19.0.3. Thanks guys!