storybookjs/storybook

[Bug]: Default stories show "Cannot find module [...]" with Storybook (v7) and Gatsby (v5)

Ouverte

#21 958 ouverte le 6 avr. 2023

 (11 commentaires) (7 réactions) (2 personnes assignées)TypeScript (10 058 forks)batch import
bugcompatibility with other toolsgatsbyhelp wantedsev:S3

Métriques du dépôt

Stars
 (89 909 étoiles)
Métriques de merge PR
 (Merge moyen 7j 22h) (184 PRs mergées en 30 j)

Description

Describe the bug

When setting up storybook v7 to a gatsby v5(?) project that uses custom babel config according to gatsby docs, default stories fail to show and instead show errors like:

Cannot find module './src/stories/Introduction.mdx'
webpackEmptyContext@http://localhost:59104/main.17f180ed.iframe.bundle.js:1:7557
_callee$/</<@http://localhost:59104/main.17f180ed.iframe.bundle.js:1:5140

or

Cannot find module './src/stories/Button.stories.ts'

webpackEmptyContext@http://localhost:59104/main.17f180ed.iframe.bundle.js:1:7557
_callee2$/</<@http://localhost:59104/main.17f180ed.iframe.bundle.js:1:5943

To Reproduce

git clone https://github.com/oskari/gatsby-v5-storybook-v7
npm run build-storybook && npx serve storybook-static

System

Environment Info:

  System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 18.14.1 - ~/.nvm/versions/node/v18.14.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.3.1 - ~/.nvm/versions/node/v18.14.1/bin/npm
  Browsers:
    Chrome: 111.0.5563.146
    Safari: 16.3
  npmPackages:
    @storybook/addon-essentials: ^7.0.2 => 7.0.2
    @storybook/addon-interactions: ^7.0.2 => 7.0.2
    @storybook/addon-links: ^7.0.2 => 7.0.2
    @storybook/blocks: ^7.0.2 => 7.0.2
    @storybook/react: ^7.0.2 => 7.0.2
    @storybook/react-webpack5: ^7.0.2 => 7.0.2
    @storybook/testing-library: ^0.0.14-next.2 => 0.0.14-next.2

Additional context

No response

Guide contributeur