storybook: [Bug]: `vue-component-meta` does not work in monorepo
Describe the bug
I’m using the new storybook 8.0.0-beta.5 but I’m not being able to get inference of more complex props and events provided by vue-component-meta. My guess is that it has something to do with the typescript config in my project:
apps
storybook
tsconfig.json
web
src
components
Button.vue
tsconfing.json
If you want I could provide a repro in case you don’t have an idea already how to fix this. It’s just a bit of work to rip out all the unrelated parts. Just let me know 😃
To Reproduce
No response
System
No response
Additional context
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 2
- Comments: 17 (10 by maintainers)
Is there any workaround yet to make vue-component-meta docgen work in monorepo, specifically in nx/vue?
tl;dr: Here is a working example using proper monorepo setup: https://github.com/larsrickert/storybook-issue-26220
As far as I can read from your comments, you are creating two projects/folders in a monorepo and try to directly import a component from the other folder right? For example inside the
apps/storybook/*folder you are importing a Vue file fromapps/web/*?If this is the case, this is not a “real” monorepo setup and therefore propably not intended to work.
Instead, your setup should look like this:
apps/webpackage as dependency to yourapps/storybook/package.jsonwith the version set toworkspace:^Anyone find a solution?
@chakAs3 @synopticum
Just to bring more attention to this issue, we are running into the same issue, using Storybook 8, and Turborepo using pnpm
@kasperpeulen and @chakAs3 bringing this to your attention. I guess https://github.com/storybookjs/storybook/issues/26220#issuecomment-1995786533 already described very well the problem and a potential solution.
After some tests I am pretty sure that this line causes the issue:
The project root for
vue-component-metais basically set to the root of the current package so everything above this folder which includes the rest of the monorepo is not analyzed.I am not 100% sure whats the best way to fix this. Maybe we should use the paths set in the
.storybook/main.tsto check if contains../and adjust the project root accordingly?Were seeing issues in quite a large repo where were running out of memory when enabling the vue-component-meta docgen. Storybook is in the same package though, it just cant cope I guess
Adding some context to https://github.com/storybookjs/storybook/issues/26220#issuecomment-1995166575 above:
We are working on a fresh installation of storybook 8 in a
packagesdirectory. Our goal is to have this storybook instance display stories for components from theuidirectory, as well as from components inside thatpackagesdirectory.The issue is that components from the
uidirectory are able to be added properly to the storybook, but can never get their jsdoc notation converted by autodocs, and their props aren’t fully interpolated into controls. This happens in any case where the component is outside of the packages directory, regardless of whether the stories file is inside packages or somewhere elseSide-by-side you can see that both button 2 (left) and button 3 (right) are nearly identical. The stories generated are very different though, with button 2 having a full complement of documented controls, and the story for button 3 having only controls for props which have args defined:
@weikinhuang Thanks for providing a repro, I didn‘t get around to do that.
Hi @vanessayuenn we’re also running into this issue with our codebase. I’ve provided a base repro case for you to check out https://github.com/weikinhuang/storybook-26220-repro
open http://localhost:6006/
See that
Example/Buttonhas the autogenerated docs, which was created bynpx storybook init, whileCore/Button3which lives outside thepackagesdirectory does not have the auto docs even though it’s 99% copy pasted from theButtoncomponent.This repo was made with
npx storybook@latest init.