diff --git a/lib/core/src/client/preview/start.js b/lib/core/src/client/preview/start.js index 444eee567a8d..f8dcf13e863c 100644 --- a/lib/core/src/client/preview/start.js +++ b/lib/core/src/client/preview/start.js @@ -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)) ); diff --git a/lib/core/src/client/preview/start.test.js b/lib/core/src/client/preview/start.test.js index 074ebcda5bca..75bfe4a4596c 100644 --- a/lib/core/src/client/preview/start.test.js +++ b/lib/core/src/client/preview/start.test.js @@ -144,6 +144,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(); });