Javascript 有没有办法让';主文件';故事书?

Javascript 有没有办法让';主文件';故事书?,javascript,reactjs,babeljs,babel-loader,storybook,Javascript,Reactjs,Babeljs,Babel Loader,Storybook,我一直在想,是否有一种方法可以为故事书创建一个“主”文件? 下面是我对文件层次结构的设想: • └── stories └── button ├── Button.js └── Button.stories.js └── SearchBox └── SearchBox.js └── SearchBox.story.js index.stories.js 其中index.stories.js将包含所有其他

我一直在想,是否有一种方法可以为故事书创建一个“主”文件?

下面是我对文件层次结构的设想:

•
└── stories
    └── button
        ├── Button.js
        └── Button.stories.js
    └── SearchBox
        └──  SearchBox.js
        └──  SearchBox.story.js
    index.stories.js
其中
index.stories.js
将包含所有其他 故事


Button.stories.js
从“React”导入React
export const with text=()=>Hello按钮;
使用表情符号导出常量=()=>(

您可以尝试将每个故事变体从它自己的故事文件导出为命名导出,然后将它们导入index.stories.js,然后从那里再次将它们一起导出

例如:

index.stories.js:

- Show All Stories Here
   - First // First would be displayed here
   - Second // Second would be displayed here
   - Allstuff // both First and Second would be displayed here
- Show All Stories Here
   - First // First would be displayed here
   - Second // Second would be displayed here
   - Allstuff // both First and Second would be displayed here