DimiMikadze / create-react-library

React NPM library starter kit based on Facebook's create react app
MIT License
602 stars 60 forks source link

Module exporting as undefined for `.jsx` file types #62

Closed ShahAnuj2610 closed 5 years ago

ShahAnuj2610 commented 5 years ago

I have my repo configured as this here => https://github.com/ShahAnuj2610/react-searchbox/tree/npm-publish now when I am exporting simple <HelloWorld /> from index.js under lib, it's working perfectly fine, but with the current state, it is exporting undefined. This is the corresponding code sandbox, where I am using this published npm library => https://codesandbox.io/s/musing-noether-fe6cc

DimiMikadze commented 5 years ago

Hi @ShahAnuj2610 what do you mean by "but with the current state," ?

ShahAnuj2610 commented 5 years ago

Hi @ShahAnuj2610 what do you mean by "but with the current state," ?

current state, as in my current branch in the link that I have mentioned

DimiMikadze commented 5 years ago

@ShahAnuj2610 I just tried to use jsx extension on demo app and it's working as expected, I've renamed Example.js to Example.jsx in src/lib/components and it worked fine.

Link you have pasted https://codesandbox.io/s/musing-noether-fe6cc contains different error: You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. That happens because you are importing external library DataSearch in App.js.

For how to use other libraries within your library, please visit: https://github.com/udilia/create-react-library#usage-of-other-libraries-within-your-library thanks!