(SvelteKit) ApexChart initialization causes "window is not defined" error on reload #4175
Replies: 3 comments
-
I managed to find a solution, but it seems very hacky... Maybe someone can help me improve my code? (Code: https://github.com/Arbee4ever/statcord_website/blob/development/src/routes/leaderboards/%5BguildId%5D/%2Bpage.svelte#L37) |
Beta Was this translation helpful? Give feedback.
-
Commenting to say that the solution from this svelte-apexcharts issue worked for me! First: Here's my
The
Here's a sample component –
The For what it's worth, I use adapter-static:
Hope this helps someone! |
Beta Was this translation helpful? Give feedback.
-
I was able to solve this by disabling SSR in the +page.server.ts. You could set it this way in that file export const ssr = false; or set it in vite.config.ts (js). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When I use this library in my SvelteKit project, I get a "window is not defined" error when I reload the page. Any idea why? (Code: https://github.com/Arbee4ever/statcord_website/blob/development/src/components/leaderboard/Member.svelte#L62)
Error:
Beta Was this translation helpful? Give feedback.
All reactions