Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

@remotion/google-fonts usage with remotion player in Next.js gives ReferenceError #1648

Closed
Just-Moh-it opened this issue Jan 6, 2023 · 2 comments 路 Fixed by #1664
Closed
Labels
bug Something isn't working

Comments

@Just-Moh-it
Copy link
Contributor

Bug Report 馃悰

I'm using a remotion player component, playing a composition that has the Montserrat from imported and used in the following manner:

import * as Montserrat from "@remotion/google-fonts/Montserrat";

const { fontFamily: montserratFontFamily } = Montserrat.loadFont("normal", {
  weights: ["400", "500", "600", "700"],
  subsets: ["latin"],
});

// usage like
<main style={{ fontFamily: montserratFontFamily, }} />

What's strange is that the error shows up randomly, only bothers 60% of the times I run the dev server, but sometimes it works like a charm and the fonts are loaded on the remotion player.

Dev environment

My package.json has the following packages

{"scripts": {
    "@remotion/bundler": "^3.3.25",
    "@remotion/cli": "^3.3.25",
    "@remotion/google-fonts": "^3.3.25",
    "@remotion/lambda": "^3.3.25",
    "@remotion/motion-blur": "^3.3.25",
    "@remotion/player": "^3.3.25",
    "remotion": "^3.3.25",

    "next": "13.0.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
}}

This is the exact error message:

ReferenceError: FontFace is not defined
    at loadFonts (/hidden-random-lolproj-ect/node_modules/.pnpm/@remotion+google-fonts@3.3.27_biqbaboplfbrettd7655fr4n2y/node_modules/@remotion/google-fonts/dist/base.js:39:34)
    at Object.loadFont (/hidden-random-lolproj-ect/node_modules/.pnpm/@remotion+google-fonts@3.3.27_biqbaboplfbrettd7655fr4n2y/node_modules/@remotion/google-fonts/dist/Montserrat.js:153:33)
    at eval (webpack-internal:///./src/animations/loving-customers.tsx:26:110)
    at Object../src/animations/loving-customers.tsx (/hidden-random-project-lol/.next/server/pages/_app.js:77:1)
    at __webpack_require__ (/hidden-random-project-lol/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/animations/templates.ts:6:75)
    at Object../src/animations/templates.ts (/hidden-random-project-lol/.next/server/pages/_app.js:88:1)
    at __webpack_require__ (/hidden-random-project-lol/.next/server/webpack-runtime.js:33:42)
    at eval (webpack-internal:///./src/store/playerSlice.ts:7:78)
    at Object../src/store/playerSlice.ts (/hidden-random-project-lol/.next/server/pages/_app.js:165:1) {
  page: '/'
}
@Just-Moh-it Just-Moh-it added the bug Something isn't working label Jan 6, 2023
@Just-Moh-it
Copy link
Contributor Author

Hey @JonnyBurger and team, hope you've read this issue 馃槃

@JonnyBurger
Copy link
Member

I missed it indeed! Sorry 馃槺 This is a good point, we should make it a no-op on the server.

@JonnyBurger JonnyBurger linked a pull request Jan 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants