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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Using fetch-mock with the decorator function results in internal error #635
Comments
Your "Link to Minimal Reproducible Example" is a 404 page. https://github.com/vudoan1708-cyber/storybook-builder-vite-error-reproduce is 404. |
Hi @JohnAlbin ! Thanks. |
@vudoan1708-cyber It looks like your decorator function isn't written properly. https://storybook.js.org/docs/react/writing-stories/decorators FYI, I just wrote a Storybook addon that integrates with fetch-mock. It should work with Svelte, though I've only tested it with React. https://github.com/JohnAlbin/storybook-addon-fetch-mock |
I am facing the same issue with TS, Vue 3 and Storybook Vite builder, when just importing
Will it help if I provide a reproducer for this case? |
I was able to workaround the above by directly importing client module in the storybook: |
What version of vite are you using?
2.7.13
System info and storybook versions
System:
OS: Windows 10
CPU: AMD Ryzen 7 5700U with Radeon Graphics
Binaries:
Node: v14.18.0
npm: 6.14.15
npmPackages:
Describe the Bug
I'm currently using storybook-builder-vite to componentise the UI components in my project. Fetch-mock works great when using with storybook alone but once, integrated with vite, it results in an internal error.
I did raise this issue to the maintainers of the storybook-builder-vite, however, they are certain the problems are not coming from their library. They said the issue could be with a sub-dependency of fetch-mock, TR46.
In the bundled code of fetch-mock's server.js file, we see:
So, we see here that
mappingTable
, is empty, sofindStatus
returns null, which breaks the last line above. This might be an error within the bundler config of fetch-mock, or a problem with themappingTable.json
that tr46 is generating, or maybe something else.Please have a look at error reproduction in the Button component's story: Make API Call using Fetch-mock.
Any help will be very much appreciated.
Thanks.
Link to Minimal Reproducible Example
https://github.com/vudoan1708-cyber/storybook-builder-vite-error-reproduce
The text was updated successfully, but these errors were encountered: