react-mutation-observer icon indicating copy to clipboard operation
react-mutation-observer copied to clipboard

Import results in "ReferenceError: window is not defined"

Open ptisdel opened this issue 6 years ago • 6 comments

There's no check for if window exists before withObserver.js uses it.

ptisdel avatar Nov 21 '18 17:11 ptisdel

I have the same issue

ridoansaleh avatar Mar 27 '19 00:03 ridoansaleh

Same here

fugudesign avatar Mar 28 '19 13:03 fugudesign

PR welcome

jcgertig avatar Mar 29 '19 01:03 jcgertig

Though this is a client only lib so if you are doing something like server side rendering code split and async load the section with this using something like System.import

jcgertig avatar Mar 29 '19 01:03 jcgertig

Me too. Ctrl+C + V from first line in npmjs.com and results this error.

jhvissotto avatar Nov 14 '19 05:11 jhvissotto

I guess it's just a matter of doing if (typeof window !== 'undefined) {...}

quochuy avatar Dec 04 '19 08:12 quochuy