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

addon-storysource - Not showing stories imported from other source files. #10769

Closed
nanandn opened this issue May 13, 2020 · 3 comments
Closed

Comments

@nanandn
Copy link

nanandn commented May 13, 2020

Storybook addons "storysource" and "docs" not loading the story source imported from other files. In the example shown below, storybook preview and docs story panel renders the component, but storysource addon panel is not loading the source. Just shows "loading source..." and docs page shows "no code available".

My example seems very simple to be included in the main story file. But in reality, each of my example may have some more logic/code. I'd like to put them in separate files and import it in the main story.

Is this possible?

For example, my story is "MyComponent.stories.jsx".

import React from "react";
import MyComponent from "mycomponent";
import SimpleComponent from "./Simple";
import AdvancedComponent from "./Advanced";

export default {
    title: "Components",
    component: MyComponent
};

export {
    SimpleComponent,
    AdvancedComponent
}

Simple.jsx

import React from 'react';

export default () => <MyComponent {...props}/>;

Advanced.jsx

import React from 'react';

export default () => <MyComponent {...props} {...advancedProps}/>;
  • @storybook/react 5.3.18
  • @storybook/addon-storysource 5.3.1.8
  • @storybook/addon-docs 5.3.1.8
@shilman
Copy link
Member

shilman commented May 15, 2020

Not possible in Storysource

@stale
Copy link

stale bot commented Jun 5, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 5, 2020
@shilman shilman closed this as completed Jun 5, 2020
@geraintwhite
Copy link

There's a conversation in #3566 about adding support for this.

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

3 participants