krambuhl / custom-event-polyfill

Polyfill for creating CustomEvents on IE9/10/11 if native implementation is missing.
MIT License
112 stars 19 forks source link

Fix error on server side #11

Closed shrpne closed 6 years ago

shrpne commented 6 years ago

I have an issue with this polyfill using it with SSR. I have added a simple check, so now it does nothing when running in the Node.js environment.

kumarharsh commented 6 years ago

In the meanwhile, you can use this fork which has @andrejpavlovic and @shrpne's changes https://www.npmjs.com/package/@playlyfe/custom-event-polyfill

evocateur commented 6 years ago

This fix is not sufficient to guard an actual node.js server environment, you need to use typeof window === ‘undefined’ instead of !window

shrpne commented 6 years ago

Thanks! I've updated this check

kumarharsh commented 6 years ago

Has been merged in my fork. New version released.