Closed SamKomesarook closed 1 year ago
styled-jsx is a client-only component that should only be used in the client components, you need to use it under client boundaries (the layout / page with "use client") or a component (marked with "use client") that imported by layout / page
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When I import a custom global font into the layout file, I receive the following error:
'client-only' cannot be imported from a Server Component module. It should only be used from a Client Component.
If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar
Create a new Nextjs13 App with the App dir enabled. Inside the root layout file, initialise a new custom font:
const font = localFont({ src: "../public/example.ttf", })
Then add the following css to the layout:
What is the expected behaviour?
A new css font family variable should be initialized for use elsewhere in the app
Environment (include versions)
Did this work in previous versions?
It works without the app dir.