impetus icon indicating copy to clipboard operation
impetus copied to clipboard

fix: allow to be imported in a SSR environment

Open ayamflow opened this issue 3 years ago • 0 comments

Hi ! I'm not sure if this is maintained anymore but I thought I'd share this little fix I had to do recently. I am building an app using sveltekit (svelte equivalent of next/nuxt) and Impetus, and during build, the prerender/SSR step breaks on the Impetus import because of a couple window calls (which is undefined in nodejs). It builds properly with this commit.

Maybe the requestAnimFrame fix could be done better but I have not perceived a performance impact.

Cheers !

ayamflow avatar Feb 10 '22 14:02 ayamflow