Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: addon-storysource doesn't display the full source when using Vite #30392

Open
killerbane opened this issue Jan 27, 2025 · 1 comment
Open

Comments

@killerbane
Copy link

Describe the bug

I am using storybook v8.5.1. When using Vite as a framework and this addon - @storybook/addon-storysource I am not able to see the the full source code.
This is similar to #29478, and the issue was fixed in #29669, but this only seems to have fixed it for webpack as framework and not Vite.

Using Vite:

Using Vite

Using Webpack:

Using Webpack

Storybook Version : ^8.5.1

Reproduction link

https://stackblitz.com/edit/github-h25xa6-fqssm5jb?file=package.json

Reproduction steps

  1. To see the results of using webpack, go to .storybook/main.ts
  2. Uncomment the commented lines and remove "@storybook/react-vite" from the framework config.

System

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 Intel(R) Core(TM) 7 150U
  Binaries:
    Node: 20.12.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.5.1 - C:\Program Files\nodejs\npm.CMD <----- active
    pnpm: 9.6.0 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (132.0.2957.115)
  npmPackages:
    @storybook/addon-essentials: ^8.5.1 => 8.5.1
    @storybook/addon-interactions: ^8.5.1 => 8.5.1
    @storybook/addon-onboarding: ^8.5.1 => 8.5.1
    @storybook/addon-storysource: ^8.5.1 => 8.5.1
    @storybook/addon-webpack5-compiler-swc: ^2.0.0 => 2.0.0
    @storybook/blocks: ^8.5.1 => 8.5.1
    @storybook/react: ^8.5.1 => 8.5.1
    @storybook/react-vite: ^8.5.1 => 8.5.1
    @storybook/react-webpack5: ^8.5.1 => 8.5.1
    @storybook/test: ^8.5.1 => 8.5.1
    eslint-plugin-storybook: ^0.11.2 => 0.11.2
    storybook: ^8.5.1 => 8.5.1

Additional context

No response

Copy link
Contributor

greptile-apps bot commented Jan 27, 2025

** Disclaimer** This information might be inaccurate, due to it being generated automatically
This appears to be a Vite-specific issue with the storysource addon. The fix needs to be implemented in the Vite builder's source loading logic, similar to how it was fixed for webpack in PR #29669. The key difference is that Vite's source loading mechanism needs to be modified to include the full source content.

Specific steps:

  1. Modify code/lib/builder-vite/src/codegen-loader.ts to ensure full source content is preserved
  2. Update source loading logic in code/addons/storysource/src/manager.ts to handle Vite's source format

This will require similar changes to those made in the webpack fix, but adapted for Vite's architecture.

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

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

No branches or pull requests

1 participant