-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/storybook/monorepo/7dqknwiqp |
@@ -15,7 +24,8 @@ export function transform(inputSource) { | |||
localDependencies, | |||
idsToFrameworks, | |||
}) => { | |||
const preamble = ` | |||
const preamble = prefix |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment
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 story
Core/Re-export source loader
to demonstrate the issueconst Story1 = () => 'story1';
const Story2 = () => 'story2';
export { Story1, Story2 };