Description
I'm new to Storybook, but when using it with Vite, I had the following two problems, and I wasted a day with the latter problem.
- To run Storybook, need to install the
@mdx-js/xxxxx
package. - global is not defined error
The global is not defined error can can be avoided by adding the preview-head.html file and adding the following code.
Seems to be due to the jest-mock package used inside the @storybook/addon-interactions
add-on.
<script>
window.global = window;
</script>
I couldn't find a description of these issues in the official documentation, but I can't use the Storybook without addressing these issues.
I was confused because @storybook/addon-interactions
was omitted without explanation in the Vite section of the official docs, even though it was the default add-on.
https://storybook.js.org/docs/react/builders/vite
I will pull request if I have time, but please let me know if my understanding is wrong.
Activity