Skip to content

🎥 Make videos programmatically with React

fix case where `document` is undefined

Jonny Burgerf4c3d6a75da0
diff --git a/packages/gif/src/canvas.tsx b/packages/gif/src/canvas.tsx
index 7eb9dd51ec..08737a177f 100644
--- a/packages/gif/src/canvas.tsx
+++ b/packages/gif/src/canvas.tsx
@@ -77,6 +77,10 @@ const calcArgs = (
};
const makeCanvas = () => {
+ if (typeof document === 'undefined') {
+ return null;
+ }
+
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');