[英]got Can't resolve 'react/jsx-runtime' error while use try to create the shared component with storybook in react-typescript
[英]Can't resolve 'react/jsx-runtime' on Bit.dev
大家好,我正在尝试使用 bit.dev 导出组件,但经过几次尝试后,我总是在组件预览时出现此错误,而在导入组件时,我总是出现错误。
Module not found: Can't resolve 'react/jsx-runtime' in '/capsule/node_modules/@bit/giovannigiampaolo.testCollection.button/dist'
有人能帮我吗?
嗨,伙计们,我正在尝试使用 bit.dev 导出组件,但经过几次尝试后,我总是在预览组件时遇到此错误,并且导入组件时总是遇到错误。
Module not found: Can't resolve 'react/jsx-runtime' in '/capsule/node_modules/@bit/giovannigiampaolo.testCollection.button/dist'
有人能帮我吗?
如果这个问题出现在typescript项目中,那么我们需要在项目中添加tsconfig.json。
由于我们不能遵循 NodeJS 的默认文件夹结构,因此我们需要为工作区创建一个环境。
参考链接: Bit Envs Overview
我们可以尝试实现上面记录的方式。
使用它我得到了 typescript、webpack 和 jest 的配置。 typescript 文件夹包含 tsconfig.json 文件,我们可以根据需要对其进行编辑。
将 React 更新到最新版本将解决问题; 为我做的。 做就是了:
yarn add react@latest
你很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.