jl-/react-slide-deck

error `window is not defined` with react-server

svassr opened this issue · 3 comments

I'm using react-server with node v6.2.2 and following packages

└── react@0.14.8
└── react-server@0.4.8 
└─┬ react-server-cli@0.4.9
  └── webpack@1.13.2 
└── react-slide-deck@0.2.3 

I received following error.

Failed to load page at "../pages/episode.js" ReferenceError: window is not defined
    at /Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/~/style-loader/addStyles.js:14:1
    at /Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/~/style-loader/addStyles.js:9:1
    at module.exports (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/~/style-loader/addStyles.js:31:1)
    at Object.<anonymous> (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/src/style.scss?0fca:7:1)
    at __webpack_require__ (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/webpack/bootstrap 4bb91fa1d64e6fc6e739:19:1)
    at Object.<anonymous> (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/src/slide.js:3:1)
    at __webpack_require__ (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/webpack/bootstrap 4bb91fa1d64e6fc6e739:19:1)
    at Object.exports.__esModule (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/src/deck.js:29:1)
    at __webpack_require__ (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/webpack/bootstrap 4bb91fa1d64e6fc6e739:19:1)
    at Object.defineProperty.value (/Users/me/Projects/myProject/dev/node_modules/react-slide-deck/dist/webpack:/webpack/bootstrap 4bb91fa1d64e6fc6e739:39:1)

I have the exact same issue with using next.js. @svassr, did you manage to get a workaround for this issue ? @jl-

If anyone still has this issue, this is how i got it working around.

Code

@aga5tya saved a life there, mate.