airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
29.85k stars 2.85k forks source link

window is not defined - vite (SSR) #2950

Open Git002 opened 1 year ago

Git002 commented 1 year ago

I'm using SvelteKit and lottie-player and after updating npm, it is giving me this error all of a sudden:

[vite] Error when evaluating SSR module /src/routes/Loader.svelte: failed to import "@lottiefiles/lottie-player"
Internal server error: window is not defined

Doing this solved the error:

if (typeof window !== 'undefined') import('@lottiefiles/lottie-player')

However, it shouldn't be the case. Strange...

Originally posted by @lessborders in https://github.com/airbnb/lottie-web/issues/2851#issuecomment-1242782840

bodymovin commented 1 year ago

hi, can you report the issue in the lottiefiles repository?