Closed saifullahakhtar closed 8 months ago
Hey @saifullahakhtar, thanks for sharing the issue. As far as I can see, it isn't related to the package itself. The error with window
is related to Next.js, so you should refer to the documentation of this framework. The error with the sound loading is about the way the library was imported into the component.
If you need more specific advice, e.g. chat gpt can provide a couple of good tips on where to look, or read the documentation of Next.js and p5 in more detail
I think we can add a proper example of using p5 addons along with Next.js and the p5 wrapper in the README on our end. WDYT @jamesrweb?
Hello @yevdyko, thank you for your response and suggestion, It'd be really helpful if you guys can add a proper example of using p5 addons and p5 wrapper along with Next.js.
Hi @yevdyko, I've resolved the 1st issue of "window is not defined" but I'm still having this error below:
TypeError: p5.loadSound is not a function.
Could you please give me any advice?
@yevdyko, any help regarding this error please?
TypeError: p5.loadSound is not a function.
@saifullahakhtar im happy to help here but I need to know:
Hello @jamesrweb, Thank you for your response, here's the code with the issue, you can test and verify.
Hello @jamesrweb, I'm reaching out regarding the code issue I mentioned earlier. Could you please take a moment to review the code snippet below and provide your insight? Your expertise would be incredibly helpful in resolving this matter.
Yes @saifullahakhtar i will get to it asap, it's on my list of things to do
@saifullahakhtar I took a look and you didn't implement p5 sound exactly as guided and forgot to await
the import
of the sound library as one example of this.
Furthermore, NextJS is tricky with top level await statements though and so you need to look upstream at both NextJS and P5 to figure that one out, this library is working as it should and the issue lays with one of those projects, most probably NextJS itself. This being the case I will now close the issue.
Hello, I'm having the two errors below in NextJS version 14, could anyone please check and let me know if I'm doing any mistake?
1) Error: window is not defined 2) TypeError: p5.loadSound is not a function
P5 Sketch Component
Main file, where I'm loading component: