-
Notifications
You must be signed in to change notification settings - Fork 50
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
"window not defined" error in NextJS app #47
Comments
Hi @SIRHAMY, thanks for raising the issue. As this is a client side project, the assumption is that You could attempt lazy loading your modules - this would be my preferred way of doing things. Alternatively you could just add a regular |
Just bit by this as well. I'm creating the wrapper component in I'll try lazy loading and a regular script tag if that fails, but in either case I'm worried about missing out on Intellisense and type checking, and confused about why this would happen when scoped to a client side only block. |
You can use with Nextjs like that.
|
|
Having the same problem using Remix. Can someone help me ? |
Create a new issue and provide all code and context such as error messages, for what you're trying to do. Ideally with a minimum viable example I can run on repl.it or stackblitz for example. |
This happens because p5 is imported before window is defined (e.g. server-side rendering and build step). By moving the require("p5") line into componentDidMount this can be resolved.
The text was updated successfully, but these errors were encountered: