storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.62k stars 9.31k forks source link

[Bug]: "Show code" doesn't show code on MDX Story #26505

Open marksy opened 8 months ago

marksy commented 8 months ago

Describe the bug

I've upgraded to v8 (Web Component flavour) and have noticed the code block/snippet doesn't show anymore after clicking the "Show code" button on an MDX docs page.

If I enable autodocs, it does show the code block for nested or other stories that don't have an MDX file.

To Reproduce

https://github.com/marksy/storybook-8-web-components

System

Storybook Environment Info:

  System:
    OS: macOS 14.4
    CPU: (12) arm64 Apple M2 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.1 - ~/.nvm/versions/node/v18.18.1/bin/node
    Yarn: 3.6.3 - ~/.nvm/versions/node/v18.18.1/bin/yarn <----- active
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.1/bin/npm
  Browsers:
    Chrome: 122.0.6261.129
    Edge: 122.0.2365.80
    Safari: 17.4

Additional context

I've only tested this on the Web Component flavour of Storybook

marksy commented 8 months ago

Screenshot for context:

screenshot

Patrickroelofs commented 6 months ago

I am experiencing the same issue with @storybook/web-components-vite

marksy commented 4 months ago

A workaround has been discovered by @mmorin-equisoft (see here)