I created a javascript library using webpack
I added the file into my react application:
import {Helmet} from "react-helmet";
ReactDOM.render(
<React.StrictMode>
<Helmet>
<script src="/static/lib.js"/>
</Helmet>
<App />
</React.StrictMode>,
document.getElementById('root')
);
when I was checking the site sources - I found out that lib.js exists in there. I have a component that needs to create an object that exists inside the lib.js file
#myComponent.js
class MyComponent extents Component {
constructor(){
this.obj = new MyObject() // here is the problem
}
}
render() {
return <div className="main-background">
some stuff
</div>;
}
}
I suspect that the problem has something to do with DomReady - the library probably doesn't get loaded and the module is not defined
my solution was to put my deploy the sdk project which I had into npm and npm install it