1

I'm trying to test the build file for the npm package I wish to publish. I have used rollup to build, generated files are - index.cjs.js, index.cjs.js.map, index.esm.js. when I import the esm.js file which has my react component defined and I send props, it shows props undefined, due to which I'm unable to test the functionality. Not sure why it's happening. Here's the code-

import ErrorBoundary from '../src/dist/index.esm'

export default function App(){
return(
<div><ErrorBoundary
onError="Hello"
><Home/></ErrorBoundaryr></div>
)
}

Here's my component in esm file-

class ErrorBoundary extends React.Component{
constructor (props){
super(props);
this.state={
hasError: false
};
}

//other part of code }

Min Yoongi
  • 396
  • 5
  • 16

0 Answers0