Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we have this awesome package in Next JS? #7

Closed
ShahriarDhruvo opened this issue Oct 2, 2022 · 4 comments
Closed

Can we have this awesome package in Next JS? #7

ShahriarDhruvo opened this issue Oct 2, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@ShahriarDhruvo
Copy link

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?

@AntzeloBRKK
Copy link

@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

@xzdarcy
Copy link
Owner

xzdarcy commented Oct 8, 2022

@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

I'm sorry I've been busy lately and haven't had time to fix this. Any relevant PRs and tests are welcome

@xzdarcy xzdarcy added the bug Something isn't working label Oct 8, 2022
@ShahriarDhruvo
Copy link
Author

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?

@xzdarcy
Copy link
Owner

xzdarcy commented Nov 26, 2022

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.

@xzdarcy xzdarcy closed this as completed Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants