reactScrollbar icon indicating copy to clipboard operation
reactScrollbar copied to clipboard

Server rendering fails

Open innche opened this issue 9 years ago • 1 comments

Hello!

I'm using reactScrollbar v0.5.1 and facing the issue with server rendering. The error is: TypeError: document.createElement is not a function at l (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:2:6647) at u (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:2:7155) at o (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:2:5997) at e.exports (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:2:8437) at Object.<anonymous> (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:2:8838) at t (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:1:439) at Object.t.exports (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:1:662) at t (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:1:439) at e.__esModule.default (MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:1:526) at MyProject\Scripts\node_modules\react-scrollbar\dist\scrollArea.js:1:531

This is pretty obvious error since there is no object "document" on server. I use Edge.js and set manually GLOBAL.document = GLOBAL; so my app won't crash on every mention of "document" but it't impossible to support all the logic like that so this need to be fixed inside reactScrollbar lib.

Thank you!

innche avatar Oct 18 '17 14:10 innche

I'm not sure with Edge.js but i faced the same issue while using it with Next.js and solved it w. "next/dynamic" {SSR: false}

tomateit avatar Dec 12 '18 07:12 tomateit