saadeghi / svelte-countup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sveltekit support

rbozan opened this issue · comments

Hi, it doesn't work when using Sveltekit because of serverside rendering:

Error: <Countup> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <Countup>.

…why rendering it on server? it's for browser

I understand that it's for the client and rendering on the server would be pointless but because of server side rendering Sveltekit will try to render your component on the server. Usually the component will have a check in place if you are on the server, and if so it will not try to render it on the server to avoid this error.

So I mean there should be a check in place to disable rendering on the server so we can use the component in Sveltekit.

Can you share a minimal reproduction link please? Because I'm also using it on sveltekit and there's no issue.