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

I'm having problems with SSR 'window is not defined' #18

Closed caiocaprio closed 5 years ago

caiocaprio commented 5 years ago

CustomEvent.prototype = window.Event.prototype; in custom-event-polyfill\custom-event-polyfill.js:42

ReferenceError: window is not defined

justinhp commented 5 years ago

@caiocaprio yes, that's bc node doesn't have a concept of window....you have to "polyfill" window with jsdom or something or only execute this polyfill client side

kumarharsh commented 5 years ago

This has been fixed in later here: https://github.com/kumarharsh/custom-event-polyfill

You will need to follow @justinhp's advice for using it server-side.