Closed ShahriarDhruvo closed 1 year ago
@ShahriarDhruvo Hey, I'm currently using the same library in nextjs too. The reason for the 'window is undefined' is because Nextjs
will run the same component in serverside first before rendering to the client and the window
object does not exist in that context. There is the dynamic
import feature of Nextjs which is supposed to solve this issue with some lazy loading the component but I haven't managed to fix that yet for me.
What I mean is that the error is correct for throwing because the library does not take care of SSR too, which is understandable due to the extra work it needs but it would be very nice feature for us working with such frameworks.
@xzdarcy If you know/think there is something we can help you with in this area please let us know so we can contribute to it
@ShahriarDhruvo Hey, I'm currently using the same library in nextjs too. The reason for the 'window is undefined' is because
Nextjs
will run the same component in serverside first before rendering to the client and thewindow
object does not exist in that context. There is thedynamic
import feature of Nextjs which is supposed to solve this issue with some lazy loading the component but I haven't managed to fix that yet for me.What I mean is that the error is correct for throwing because the library does not take care of SSR too, which is understandable due to the extra work it needs but it would be very nice feature for us working with such frameworks.
@xzdarcy If you know/think there is something we can help you with in this area please let us know so we can contribute to it
I'm sorry I've been busy lately and haven't had time to fix this. Any relevant PRs and tests are welcome
When you implement your library in a fresh NextJS project you'll face that error. If you don't please let us know. And when do you plan to release this package as beta?
I'm sorry that I have been busy with work recently and haven't updated for a long time. I just removed the window reference and released version 0.0.4. Feedback is welcome for any questions.
Hey bro, I wanna use this package in one of my package. Currently I am facing trouble implementing it in next.js the error is some thing to do with "window". So do you plan to support nextjs too? If you want I can reimplement it in next and give you the exact errors?