Skip to content

Documentation of precautions when using Vite #18399

Closed
@ghost

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.

#17516

<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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions