I've been provided a min.js file from a third-party. And I want to import this into my existing ReactJS project.
I've found some samples on how to get started with their third-party features. Each sample follows this general approach though (where ABC.min.js below represents the file they have provided). The particular example below ends up rendering an image inside of the canvas:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js"></script>
</head>
<body>
<div>
<canvas id="canv123" style="width:250px;height:250px"></canvas>
</div>
<script type="module">
import * as ABC from "../ABC.min.js";
let object = new ABC.foo("canv123");
object.resrcEx = new ABC.BaseResrcEx("./assets");
object.loadCfg("./cfgs/sample.json");
</script>
</body>
</html>
Unfortunately, the third-party does not have their ABC package published (I cannot download it through yarn or npm). I only have the ABC.min.js file which they've provided me. It contains the function calls that are being imported and executed inside the script tag (as per their sample above).
I'm not sure how this would translate into my existing ReactJS application (I'm trying to implement their example inside a React component). What is the best way to achieve this "in the ReactJS way"?
In particular, I'm not sure what is the best way to incorporate the ABC.min.js file and the logic associated with it (as per the example above). I've created a new react-component and inside of componentDidMount() I've tried placing the same code found inside their script tag above (...let object = new ABC.foo("canv123"); ...etc. etc). But I am unable to do the declaration import * as ABC from ./ABC.min.js in the first place. Instead, I get error message that states "could not find a declaration file for module ./ABC.min.js".
This link here sounds similar to what I need (but again, as mentioned in previous paragraph, in my case, it cannot find declaration file for the module): How to include custom JS files in to React create app
TLDR:
I'm trying to import a min.js file into a ReactJS project. The original publisher does not have the package accessible through npm/yarn. What are my options?