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

[Issue] Make sveltedoc-parser a peer dependency #563

Open
1 task done
Narretz opened this issue Feb 21, 2023 · 2 comments
Open
1 task done

[Issue] Make sveltedoc-parser a peer dependency #563

Narretz opened this issue Feb 21, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Narretz
Copy link

Narretz commented Feb 21, 2023

What version of vite are you using?

4.0.4

System info and storybook versions

System:
OS: Windows 10 10.0.22621
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.22621.1105.0), Chromium (110.0.1587.50) -> also Firefox, why this command forgor 💀 about Firefox?
npmPackages:
@storybook/addon-actions: ^6.5.16 => 6.5.16
@storybook/addon-essentials: ^6.5.16 => 6.5.16
@storybook/addon-links: ^6.5.16 => 6.5.16
@storybook/builder-vite: ^0.4.0 => 0.4.0
@storybook/vue: ^6.5.16 => 6.5.16

Describe the Bug

I noticed that builder-vite depends on sveltedoc-parser even if your app uses no svelte at all: https://github.com/storybookjs/builder-vite/blob/baf4d7d09e95049a11e38b46e7373ba17d08ceec/packages/builder-vite/plugins/svelte-docgen.ts

Which means that sveltedoc-parser pulls in tons of dependencies, acorn, estree, eslint etc. All which could (and probably will) have different versions, even if you use them in your app. The whole node_modules for me is like 10MB. There really should be a way to do this differently. It's a general problem with storybook, it pulls in too many dependencies that are not relevant.

Could this handled by making sveltedoc-parser a peer dependency and using a dynamic import in the svelte-docgen plugin?

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.
@Narretz Narretz added the bug Something isn't working label Feb 21, 2023
@IanVS
Copy link
Member

IanVS commented Feb 21, 2023

You're right that there are some extra dependencies with this builder, because it can be used in lots of different frameworks. That has been re-architected in Storybook 7.0, where frameworks have been redefined to be a combination of a renderer and a builder. So you might install @storybook/react-vite for instance, and that will include only react and vite-related dependencies.

Unfortunately I don't think it makes sense to make big changes to 6.5 at this point. 7.0 will be released out of beta very soon, and if we changed sveltedoc-parser to be a peer dependency, Svelte users will be confused because they won't expect that they will need to install it. If size of dependencies is a concern for you, I would strongly recommend upgrading to the 7.0 beta, which drastically improves the number and size of dependencies. You can use npx sb@next upgrade --prerelease to try it out.

@Narretz
Copy link
Author

Narretz commented Feb 21, 2023

Thanks @IanVS. I will try storybook 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants