storybookjs/storybook
[Bug]: Bad error message when trying to use JSX in .js file
開放
#21,662 建立於 2023年3月17日
bugbuilder-vitehelp wanted
倉庫指標
- 星標
- (89,909 顆星)
- PR 合併指標
- (平均合併 7天 22小時) (30 天內合併 184 個 PR)
描述
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