I responded in your other thread as well: from the issues on the DepthKit repo it looks like while they have an npm package it’s not actually properly built to be used as module.
So you’re struggling to bring a broken package in, which is not surprising
You should be able to include it via a regular script tag. You can create a script tag with a script in it from inside a component and wait for it to load, then continue accessing the code inside
const script = document.createElement("script");
script.src = "https://unpkg.com/vconsole@latest/dist/vconsole.min.js";
script.onload = () => {
// code is ready, start using the code in it, no need to import anything
// the library will have documentation on how to access it (e.g. via a global)
}
document.body.appendChild(script);
if you read require somewhere it means it’s for that other standard and you can usually replace it with import.
Most libraries have code samples for both
I did initially try swapping require to import which caused errors. I’ll have a few shots at it next week but otherwise if it doesn’t work I’ll just give up and use their own three.js samples that work
I did but then the scripts the script depended on needed to be added there and there were a lot I might try adding all of them there as script tags and just see if it works.
@marcel I have just cracked using Depthkit in Needle using a local copy of DepthKit in the /src/ folder but it is from this PR in case you wanted to rely on an npm package version.
I will PM Marcel a Gdrive link to the sample project, feel free to use in your samples of course!