Can I import stories from another project? #13790
Unanswered
wagedomain
asked this question in
Help
Replies: 1 comment 6 replies
-
If the components in node_modules are already bundled in CJS, shouldn't it be possible to include those stories? I'm pretty sure we used to do this successfully with Storybook's design system before we introduced composition. As for theming, we've discussed the idea of making it possible to theme composed storybooks. If this were implemented, would you be willing to work around the other limitations you listed, e.g. by publishing versioned storybooks? cc @tooppaaa @oliviertassinari @itsderek23 |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! Thanks for reading this.
I know composition exists, but in our original investigation it does almost what we need but falls short. Our setup is a bit strange, we have a 3-tier set of projects. We have: Base Components -> Themed Components -> Applications.
All of these pieces are in different repos. The Base Components are sometimes passed through to the Application as-is, with just a different skin applied, so the set of components in each library is not a 1:1. Something can be in the middle tier that doesn't exist in Base as well.
What we want to do is: create a storybook instance in the middle tier (themed components) that includes the base components and their stories in a single storybook instance.
Composition didn't work for two reasons: the first is the theme from the Base project was used for the Base Components. We want the middle tier's theme to override this. The second reason is versioning - we have many versions of Base and the middle tier is not guaranteed to be on latest. For this reason, URL-based composition becomes tricky.
What we were hoping for: We want to be able to import the stories from node_modules of the installed package, using a glob or something similar.
However, when we tried this, we discovered that any kind of bundling made this impossible, and removing the stories from the bundle also seems to break since it's looking for components.
Beta Was this translation helpful? Give feedback.
All reactions