[Bug] Incopatibility with storybook-addon-next
See original GitHub issueWhat version of vite
are you using?
vite v3.1.3
System info and storybook versions
System: OS: MacOS BigSur 11.7 CPU: 2.3 GHz Quad-Core Intel Core i7 Binaries: Node: 16.16.0 yarn: 1.22.15 Browsers: Chrome: 105.0.5195.125 npmPackages: “@storybook/addon-actions”: “6.5.12”, “@storybook/addon-essentials”: “6.5.12”, “@storybook/addon-links”: “6.5.12”, “@storybook/builder-vite”: “0.2.2”, “@storybook/react”: “6.5.12”, “storybook-addon-next”: “1.6.9”,
Describe the Bug
Using storybook-addon-next in combination with builder-vite produces an error once storybook server started.
Reproduce repo link. I’ve added instruction to start.
A warning message:
Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more:
Error message is somehow related with next-image-stub.js
:
Uncaught TypeError: Invalid Version: undefined
at new SemVer (semver.js:19:13)
at compare (compare.js:3:3)
at Object.gt (gt.js:2:29)
at node_modules/storybook-addon-next/dist/images/next-image-stub.js (next-image-stub.js:7:22)
at __require2 (chunk-S5KM4IGW.js?v=7ad206d8:18:50)
at node_modules/storybook-addon-next/dist/preview.js (preview.js:7:1)
at __require2 (chunk-S5KM4IGW.js?v=7ad206d8:18:50)
at dep:storybook-addon-next_dist_preview__js:1:16
Steps to reproduce
- Clone repository
- yarn
- yarn storybook:start
- Once Vite bundled, go to http://localhost:6006/
- Inspect an error in console
Video
Link to Minimal Reproducible Example
Branch bug: https://github.com/dvakatsiienko/next-vite-storybook/tree/bug
Participation
- I am willing to submit a pull request for this issue.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Next.js + TypeScript + Storybook compatibility issues #9610
Describe the bug Following the TypeScript instructions & recommended config in the Storybook docs results in TS2769: No overload matches ...
Read more >@storybook/addon-viewport | Yarn - Package Manager
Storybook Viewport Addon allows your stories to be displayed in different sizes and layouts in Storybook. This helps build responsive components inside of ......
Read more >Frequently Asked Questions - Storybook - JS.ORG
Is it possible to browse the documentation for past versions of Storybook? What icons are available for my toolbar or my addon? I...
Read more >Upgrade to Webpack 5 breaking Storybook 5
See this explanation of the builders and Webpack 5 compatibility. ... import { addons } from '@storybook/addons'; import { themes } from ...
Read more >storybook/preset-create-react-app
Compatibility. This version (4.x) of @storybook/preset-create-react-app is compatibly with Create React App version 5 and above.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve created an issue for storybook-addon-next as well, RyanClementsHax/storybook-addon-next#120. @RyanClementsHax gave his comment from his side why it won’t work for now, so let’s wait I guess.
Next.js isn’t officially supported by the storybook vite builder, for the reasons mentioned above. I think you’re best off sticking with the webpack builder when using next.js, to avoid different behaviors between your storybook and app.
If you’d like to speed things up a bit, you can try out storybook 7.0, which should be a good deal faster, even when using Webpack.