Skip to content

🎥 Make videos programmatically with React

don't load fonts on server

Jonny Burgeread4ef482c23
diff --git a/packages/google-fonts/src/base.ts b/packages/google-fonts/src/base.ts
index 68160156dd..4f14c2209c 100644
--- a/packages/google-fonts/src/base.ts
+++ b/packages/google-fonts/src/base.ts
@@ -26,6 +26,11 @@ export const loadFonts = (
} => {
const styles = style ? [style] : Object.keys(meta.fonts);
for (const style of styles) {
+ // Don't load fonts on server
+ if (typeof FontFace === "undefined") {
+ continue;
+ }
+
if (!meta.fonts[style]) {
throw new Error(
`The font ${meta.fontFamily} does not have a style ${style}`