简体   繁体   中英

Can't resolve 'react/jsx-runtime' on Bit.dev

Hi Guys I'm trying to export a component with bit.dev but after several attempts I always get this error on the preview of the component and importing the component I always get error.

Module not found: Can't resolve 'react/jsx-runtime' in '/capsule/node_modules/@bit/giovannigiampaolo.testCollection.button/dist'

Can someone help me?

Hi Guys I'm trying to export a component with bit.dev but after several attempts I always get this error on the preview of the component and importing the component I always get error.

Module not found: Can't resolve 'react/jsx-runtime' in '/capsule/node_modules/@bit/giovannigiampaolo.testCollection.button/dist'

Can someone help me?

If this issue is in the typescript project then, we need to add tsconfig.json to the project.

Since we cannot follow the default folder structure of NodeJS, we shall need to create an environment for the workspace.

Reference Link: Bit Envs Overview

We can try to implement the way documented above.

Using this I got configurations of typescript, webpack, and jest. The typescript folder contained the tsconfig.json file and we can edit it to our requirements.

Updating your React to the latest version will solve the issue; did it for me. Just do:

yarn add react@latest

and you're good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM