react-d3-tree: ReferenceError: window is not defined - Server-Side Rendering (SSR)
How to use this great library properly with Server-Side Rendering (SSR)
ReferenceError: window is not defined
- react-d3-tree.min.js:1
[frontend]/[react-d3-tree]/lib/react-d3-tree.min.js:1:4937
- react-d3-tree.min.js:1
[frontend]/[react-d3-tree]/lib/react-d3-tree.min.js:1:4899
- react-d3-tree.min.js:1 e.exports
[frontend]/[react-d3-tree]/lib/react-d3-tree.min.js:1:5409
return window&&document&&document.all&&!window.atob
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 15 (9 by maintainers)
@thomashibbard same window not defined issue even with NoSSR. I finally got it working by doing a inline import
this worked for me
@codemonkeycxy you can also use npm’s package react-no-ssr as a workaround
https://github.com/kadirahq/react-no-ssr/blob/master/src/index.js
Hi @bkrem Thank you for your almost instantaneous answer. Yes, I checked that too. I built it without UglifyJsPlugin and it’s used for
I investigated problem a little https://github.com/webpack-contrib/style-loader/blob/67120f8dc831626f466d64513b4e26074e89341b/lib/addStyles.js#L23 Problem occures during
import