You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The next/font/google imported font is causing TypeError Cannot read properties of undefined (reading 'className') on Storybook. I have searched and tried everything I could find including:
Reinstalling Storybook
Reproducing in a new project
Using .variable instead of .className
Upgrading to Storybook 8
Overriding enhanced-resolve to version 5.10 from 5.11
Importing the font locally
Importing the font from next/fonts/google directly in preview.tsx
Discussed in #26462
Originally posted by colmukrainec March 13, 2024
Summary
The
next/font/google
imported font is causingTypeError Cannot read properties of undefined (reading 'className')
on Storybook. I have searched and tried everything I could find including:.variable
instead of.className
enhanced-resolve
to version 5.10 from 5.11next/fonts/google
directly inpreview.tsx
File structure:
Note: Additionally I tried the default
stories
folder and files that are made automatically by runningnpx storybook@latest init
To reproduce:
npx create-next-app@latest
npx storybook@latest init
./src/lib/font.ts
./src/lib/font.ts
:src/app/layout.tsx
should be edited to appear as:npm run dev
the next web app.storybook/preview.ts
file should be edited to appear as:preview.ts
topreview.tsx
to fix the errorsnpm run storybook
Additional information
main.ts:
Note: This was untouched as it was autogenerated.
Create a reproduction
No response
The text was updated successfully, but these errors were encountered: