Storybook 10 -> Next JS 16.0.3 -> Vitest Conflicts #33181
Replies: 1 comment 9 replies
-
|
Hi @chrisbeldam! I'm Dosu and I’m helping the storybook team. The error is happening because Storybook's Next.js navigation mock imports from a deep internal Next.js path without the Here’s how you can work around it:
Keep in mind: If you create custom mocks for deep internals, you’ll need to keep them in sync with any Next.js API changes. Watch for updates from Storybook and Next.js for upstream fixes. If you need more help, please share a minimal reproduction or your current Vitest config. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I've recently joined a team which is using Next 16.0.3. I've upgraded to Storybook 10.0.8 to allow for Storybook to load again.
Our codebase is using the following mocks
However when running our Vitest Suite we get the following error:
Error: Cannot find module '/Users/christopherbeldam/Code/eb-sherloc-web-app/node_modules/next/dist/client/components/navigation' imported from /Users/christopherbeldam/Code/eb-sherloc-web-app/node_modules/@storybook/nextjs/dist/export-mocks/navigation/index.js Did you mean to import "next/dist/client/components/navigation.js"?It looks like Storybook is looking for a file without the
.jsextension which does not exist anymore in NextJS from what i can see.Is there a way to fix this? Temporarily mock these functions etc?
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions