create-react-library
create-react-library copied to clipboard
Unable to destructure exported components
When importing components from my library, I have to import the entire package.
Is this the normal behaviour create-react-library, an issue with my code, or a bug?
This works:
...
import Kit from 'my-ui-kit';
...
function App = () => {
return <Kit.CoolComponent />
}
But not
...
import { CoolComponent } from 'my-ui-kit'
function App = () => {
return <CoolComponent/>
}
Here's the error I get:
Attempted import error: 'CoolComponent' is not exported from 'my-ui-kit'.
dist/index.modern.js is clearly exporting the component:
...
var index = {
CoolComponent: CoolComponent
}
export default index