storybookjs/storybook

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

Open

#21,958 建立於 2023年4月6日

在 GitHub 查看
 (11 留言) (7 反應) (2 負責人)TypeScript (89,909 star) (10,058 fork)batch import
bugcompatibility with other toolsgatsbyhelp wantedsev:S3

描述

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

貢獻者指南