From 46cc577a7e4314342069c96a9f842b2bc68d891b Mon Sep 17 00:00:00 2001 From: Dev-CasperTheGhost <53900565+Dev-CasperTheGhost@users.noreply.github.com> Date: Thu, 19 Aug 2021 20:16:25 +0200 Subject: [PATCH] fix: `matchMedia is not defined` --- src/core/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/utils.ts b/src/core/utils.ts index 098159a..d22a2fa 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -21,7 +21,7 @@ export const prefersReducedMotion = (() => { let shouldReduceMotion: boolean | undefined = undefined; return () => { - if (shouldReduceMotion === undefined) { + if (shouldReduceMotion === undefined && typeof window !== "undefined") { const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)'); shouldReduceMotion = !mediaQuery || mediaQuery.matches; }