When deploying my SvelteKit app to Cloudflare Pages, it builds without issue but navigating to the site shows my navbar and footer, with an error message of global is not defined
.
In the console, I get the message Failed to load resource: the server responded with a status of 500 ().
Solutions like defining global in the index.html or configuring Vite to define it did not work either. These two resources did not prove to be effective, one and two.
My understanding is that this error can occur when there are nodejs (cjs) libraries or code trying to run in a non-node environment, however the app seemed to work perfectly when deploying to other JAMstack platforms. The build preview also worked on my machine. This leads me to believe it's a Cloudflare Pages related issue, though it seems more probable that it's a framework error somehow.