I have downloaded, built and import the stardog.js code from GitHub (v1.3.0), but I cannot get my browser-based javascript to load all the dependencies. When the code hits a “require” statement, I get an “Uncaught ReferenceError: require is not defined” error.
Clearly, I have missed some step or did not correctly locate all the necessary files.
Can you say a bit more about how you are building and trying to import stardog.js into your browser-based code? For example, are you using a module bundler (such as browserify or webpack), or are you trying to include stardog.js directly via a <script> tag? Describing your steps would help us to help you.
Assuming no module bundler, at the most basic level, you should be able to simply npm install stardog (no need to build it on your own), add a <script> tag to your HTML that references the distributed stardog.js code (e.g., <script src="./node_modules/stardog/dist/stardog.min.js"><script>), and then use stardog.js via the global stardogjs object. For example, if I had a basic index.html file in a directory named ‘app’, I would run npm install stardog in that directory, and then put the following in index.html: