storybookjs / storybook

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

[Bug]: addon-storysource doesn't display the full source #29478

Open rajprashanthr opened 3 weeks ago

rajprashanthr commented 3 weeks ago

Describe the bug

I am using storybook react of version v8.3.6 . I have added storysource addon to the react webpack storybook sample in stackblitz to test the display of story file's full source in the addons. I am not able to bring it up. It only brings up the 'code' tab in the addons and displays the rendered piece of code for that particular story

Please find my main.js file below

/** @type { import('@storybook/react-webpack5').StorybookConfig } */ const config = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], addons: [ "@storybook/addon-webpack5-compiler-swc", "@storybook/addon-onboarding", "@storybook/addon-links", "@storybook/addon-essentials", "@chromatic-com/storybook", "@storybook/addon-interactions", "@storybook/addon-storysource", ], framework: { name: "@storybook/react-webpack5", options: {}, }, }; export default config;

Reproduction link

https://stackblitz.com/edit/github-h25xa6?file=.storybook%2Fmain.ts

Reproduction steps

  1. In the stackblitz link , please note the addon-storysource being added to main.ts file's addons
  2. Though the code tab appears in the addons section, it doesn't display the story's source in it

System

npx storybook@8.4.0-beta.1 info npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm WARN deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

Storybook Environment Info:

System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm <----- active pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: @storybook/addon-essentials: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/addon-interactions: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/addon-onboarding: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/addon-storysource: 8.4.0-beta.1 => 8.4.0-beta.1 @storybook/addon-webpack5-compiler-swc: ^1.0.5 => 1.0.5 @storybook/blocks: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/react: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/react-webpack5: ^8.4.0-beta.1 => 8.4.0-beta.1 @storybook/test: ^8.4.0-beta.1 => 8.4.0-beta.1 storybook: ^8.4.0-beta.1 => 8.4.0-beta.1

Additional context

No response

slax57 commented 2 days ago

I think I managed to find the source of the issue: See https://github.com/storybookjs/storybook/pull/29669 🤞