fix(image-loader): make SSR compatible using a window type check guard

This commit is contained in:
Eric Y Liu 2021-06-26 12:53:11 -07:00
commit 04056e88c9

View file

@ -67,7 +67,7 @@
let image = null;
$: loading = !loaded && !error;
$: if (src) loadImage();
$: if (src && typeof window !== "undefined") loadImage();
$: if (loaded) dispatch("load");
$: if (error) dispatch("error");