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

5.3k Views Asked by At

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?

2

There are 2 best solutions below

2
On

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.

0
On

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.