From 1873f605d08075e289291b80a23f26e4eb451277 Mon Sep 17 00:00:00 2001 From: Evert van der Horst Date: Thu, 18 Jan 2024 10:23:56 +0100 Subject: [PATCH] Fix(useFlip): prevent registerPlugin from running on server --- src/gsap/hooks/useFlip/useFlip.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gsap/hooks/useFlip/useFlip.ts b/src/gsap/hooks/useFlip/useFlip.ts index 69f14a3..aeff9b8 100644 --- a/src/gsap/hooks/useFlip/useFlip.ts +++ b/src/gsap/hooks/useFlip/useFlip.ts @@ -3,7 +3,9 @@ import Flip from 'gsap/Flip'; import { useEffect, useRef, type MutableRefObject } from 'react'; import { unref, type Unreffable } from '../../../utils/unref/unref.js'; -gsap.registerPlugin(Flip); +if (typeof window !== 'undefined') { + gsap.registerPlugin(Flip); +} export function useFlip( ref: Unreffable,