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

Source-loader: Bypass if file has no exports #9505

Merged
merged 1 commit into from Jan 17, 2020

Conversation

atanasster
Copy link
Member

Issue: #9457 #9412

What I did

source-loader does not handle named exports that are separate from the story definitions.
This PR bypasses the source-loader when it is unable to parse a file, so the stories will appear in the sidebar. However the source code will not available to see in docs mode.

How to test

added a storyCore/Re-export source loader to demonstrate the issue

const Story1 = () => 'story1';
const Story2 = () => 'story2';

export { Story1, Story2 };

@vercel
Copy link

vercel bot commented Jan 17, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/7dqknwiqp
✅ Preview: https://monorepo-git-fork-atanasster-source-loader-reexports.storybook.now.sh

@@ -15,7 +24,8 @@ export function transform(inputSource) {
localDependencies,
idsToFrameworks,
}) => {
const preamble = `
const preamble = prefix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the concept of prefix? can you make a short comment above this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not specific to prefix, just to signify the source loader is not parsing this file. Also prevents an rte since prefix was being used without a check below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment

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

Successfully merging this pull request may close these issues.

None yet

2 participants