Martinibomb
Martinibomb
DDeno
Created by Martinibomb on 2/12/2025 in #help
"window" global issues using the p5.js library in a Deno / Fresh project
Hi I'm trying to use the p5.js library to make a little game on my site that uses Deno and Fresh. I tried directly using the p5.min.js download, the p5.js NPM package, and this p5 wrapper that says it's compatible with Deno / TS: https://jsr.io/@kaleidosium/p5-wrapper-ts. All of these result in the same "window is not defined error" coming from p5.js because p5 is trying to use the window global and i'm wondering if there is any way to fix this. I was thinking to try replacing the window calls in the p5 file but it's transpiled into an illegible form of js. It's also strange that the p5-wrapper package says it works with Deno so I'm just wondering if there's something i'm missing here, or another way to use p5 with Deno. Might just try importing with a CDN next or just using Three.js for now. Thanks!
3 replies