Skip to content

Commit

Permalink
CSF: Ignore __esModule export (#8317)
Browse files Browse the repository at this point in the history
CSF: Ignore __esModule export
  • Loading branch information
shilman authored Oct 7, 2019
2 parents 0a273d6 + d3debad commit c669021
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/core/src/client/preview/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function matches(storyKey, arrayOrRegex) {

export function isExportStory(key, { includeStories, excludeStories }) {
return (
// https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs
key !== '__esModule' &&
(!includeStories || matches(key, includeStories)) &&
(!excludeStories || !matches(key, excludeStories))
);
Expand Down
4 changes: 4 additions & 0 deletions lib/core/src/client/preview/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ describe('STORY_INIT', () => {
});

describe('story filters for module exports', () => {
it('should exclude __esModule', () => {
expect(isExportStory('__esModule', {})).toBeFalsy();
});

it('should include all stories when there are no filters', () => {
expect(isExportStory('a', {})).toBeTruthy();
});
Expand Down

1 comment on commit c669021

@vercel
Copy link

@vercel vercel bot commented on c669021 Oct 7, 2019

Choose a reason for hiding this comment

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

Please sign in to comment.