AgoraIO-Community / VideoUIKit-Web-React

A Web library to simply integrate Agora Video Calling or Live Video Streaming to your website with just a few lines of code.
MIT License
53 stars 42 forks source link

Gatsby - error "window" is not available during server side rendering. #2

Closed gdSuhail closed 2 years ago

gdSuhail commented 2 years ago

Hi @EkaanshArora, Thanks for the UiKit.

I have added the UIKit to one of our Gatsby project and it is working great but the problem is occuring during the build process. I am getting the error "window" is not available during server side rendering. error during running the build. The error is coming in the AgoraRTC_N-production.js file. I tried checking the condition of isBrowser() and then rendering the AgoraUIKit but still the same error is occuring. Please tell me how can I fix this issue. Thanks

image

EkaanshArora commented 2 years ago

Are you also handling the UIKit importusing the isBrowser() check?

gdSuhail commented 2 years ago

Are you also handling the UIKit importusing the isBrowser() check?

Thanks for reply. No, I am importing it directly and checking the condition before rendering.

edit: I tried importing(require) based on the condition and it fixed the issue.

Thanks for the help.