react-carousel: window is not defined
An error happens during build after recent update to @brainhubeu/react-carousel@1.12.6:
ReferenceError: window is not defined at Object.<anonymous> ([ROOT]/react/node_modules/ brainhubeu/react-carousel/lib/react-carousel.js:1:279
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 21 (9 by maintainers)
Hi, I was having the same issue with NextJS, I tried to check the source code but I didn’t find anything weird so I find a solution for this. What I did was dynamic importing with no SSR
So, instead of the traditional importing:
import Carousel from '@brainhubeu/react-carousel'This works for me, have a nice day.
@nescha @Neddz @Sorvereign
I have a workaround https://github.com/brainhubeu/react-carousel/pull/292 I published it as
@brainhubeu/react-carousel@1.12.9-alpha. Could you check whether it works for you? Do you think my workaround is better or usingnext?See possible fix via webpack config to reinstate webpack 3 behaviour on #344.
@piotr-s-brainhub it does. Including it in future releases would be very helpful.