storybookjs/storybook
[Bug]: Bad error message when trying to use JSX in .js file
オープン
#21,662 opened on 2023/03/17
bugbuilder-vitehelp wanted
Repository metrics
- Stars
- (89,909 個のスター)
- PR merge metrics
- (平均マージ 7d 22h) (30d で 184 merged PRs)
説明
Describe the bug
[storybook:inject-export-order-plugin] Parse error @:22:29
file: ........./src/stories/ApiDocumentation.stories.js
ERR! Error: Parse error @:22:29
ERR! at parse ........./node_modules/es-module-lexer/dist/lexer.cjs:1:402)
ERR! at Object.transform (........./node_modules/@storybook/builder-vite/dist/index.js:1:3217)
ERR! at file:///.........//node_modules/rollup/dist/es/shared/node-entry.js:24343:40
The above error will happen if your .stories.js file contains any JSX. Renaming the file to .jsx fixes the issue. I spent hours trying to figure out the problem. Some better error messaging would be nice here.
To Reproduce
Happens in sandbox project with React and Vite.
System
No response
Additional context
No response