我能够成功运行故事书并在故事书项目文件夹中开发反应组件。但是,我试图将包含我所有组件的文件夹向上移动一个级别(成为故事书文件夹的同级文件夹)。
所以,而不是这样的结构
storybook
??? components
? ??? Foo.js
? ??? Bar.js
??? stories
? ??? index.stories.js
Run Code Online (Sandbox Code Playgroud)
我有这样的文件夹结构
my_example_project
??? my_components
? ??? Foo.js
? ??? Bar.js
??? my_storybook
? ??? ...
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试将组件导入故事时,出现以下错误
ERROR in ../my_components/Bar.js 4:9
Module parse failed: Unexpected token (4:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| const Bar = () => {
> return <div>I am a Bar</div>;
| }; …Run Code Online (Sandbox Code Playgroud)