Hey guys, I'm trying out SvelteKit with Appwrite and using @sveltejs/adapter-static.
I'm getting a error of 'window is not defined' when I run 'npm run dev'.
I have added export const prerender = true; in +layout.js in the root of routes folder.
Not sure what is wrong. Would like for some assistance or guidance on this.
Thanks in advance!
Summary
The user was experiencing an error stating that 'window is not defined' when running their SvelteKit project with the Adapter Static. They mentioned that they had added `export const prerender = true;` in the +layout.js file in the root of the routes folder. The issue was resolved when the user realized they had imported some extra Appwrite functions that were causing the problem. The solution was to remove the unnecessary imports. It was mentioned that using realtime functionality could be problematic with the static adapter and pre-renders, so the user was advised to keep that in mind for future reference.
Drake
Admin
Mar 22, 2023, 04:29
What exactly is throwing this?
Meldiron
Mar 22, 2023, 09:38
Are you using realtime functionality? That might be problematic with static adapter and pre-renders.
Omnificent
Rank 1: Thread
Mar 22, 2023, 16:51
Ahh sorry for the late reply. Didn't get notified.
Anyways, I fixed the problem. I imported in some extra Appwrite functions which I wasn't using and it was causing some issues.
Haven't tried realtime yet but will keep in mind if I come across this again. Thanks!
Drake
Admin
Mar 22, 2023, 17:10
[SOLVED] Window is not defined when running in SvelteKit using Adapter Static