Search code examples
javascriptreactjsbabeljsbitbit.dev

React is not defined when install one exported component on bit.dev


I have followed the official tutorial of Bit for React. And the result is here: https://bit.dev/vibe/react-admin-components/action-buttons

The problem is, I can not install the above component in another project as a npm package. It says React is undefined when run time (not build time) with this import: import ActionButtons from '@bit/vibe.react-admin-components.components';

I believe this is a happy case, there is no magic here. Maybe babel is the issue here when I use React 17 and babel 7.

Any idea will be highly appreciated.


Solution

  • I'm Josh from the Bit team.
    I published a new version of the React compiler that now support React 17, please use the new version and re-export your component. https://bit.dev/bit/envs/compilers/react?version=1.0.23