module.exports Cannot set property of undefined

Viewed 4889

I am trying to move all react components to separate repo so that they can be shared. I am getting the above error

ui-react/index.js

'use strict';

import Button from "./components/Button/Button";

module.exports.Button = Button;

FileB

import  {Button} from  'ui-react';

When i do this i get an error called.

'ui-react' does not contain an export named 'Button' 

PS: In package.json of ui-react i have set main to index.js and i have also tried import "ui-react/index"

1 Answers

No need to write module.exports. You can write

export { Button };
Related