If I want to add a new package via npm, what is the best place to issue the command from?
For exampleā¦ I open the VSCode workspace and use the menu to open a new terminal and it offers me two paths to openā¦ one in the main project and one in the node modules folder.
I am going to do ānpm install new-packageā from there, but should I be doing something entirely different like adding the package name to one of the config files instead of manually using the npm install command.
I had an error occur once when i did the --save but i will try again and pay more attention if something doesnāt work right. In any case I can do the install without the --save and then add it package.json manually
I had no problems using vite plugin mkcert via the add to package.json then using the install button from the Export Info component. But I am now trying the same with depthkit.js so I added "depthkit": "^1.0.0", to package.json, used install button, can see it in the node modules folder but in VS Code I want to import it into a ts script like import Depthkit from "depthkit"; and it doesnāt register it when I use some sample code like:
import { Behaviour, GameObject } from "@needle-tools/engine/engine-components/Component";
import * as THREE from "three";
import Depthkit from "depthkit";
export class DepthKitExample extends Behaviour {
start()
{
var depthkit = new DepthKit();
depthkit.load(
"myClip.txt",
"myClip.mp4",
character => {
scene.add(character);
}
);
}
}
oof, might have needed to do this import Depthkit from "depthkit/src/depthkit.js";, I think I was relying on VS Code autofill finding scripts in the past but it didnāt for this one
Although shortly after that, on local server run I get this error when using this .ts script in the scene, why does the path of the npm module change so much in the build? I assume it is looking for it at import Depthkit from "depthkit/src/depthkit"; when it is probably at import Depthkit from "node_modules/.vite/deps/depthkit_src_depthkit";
GET https://192.168.50.67:3000/node_modules/.vite/deps/depthkit_src_depthkit.js?v=dd714a5d net::ERR_ABORTED 504 (Gateway Timeout)
I also get the below error after running in VS Code terminal manually npm install --save depthkit and changing the import to import Depthkit from "depthkit";
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/depthkit.js?v=893bd4ef' does not provide an export named 'default' (at DepthKitExample.ts:2:8)
I only used a custom npm package before with mkcert which isnāt something I pull in with scripts at runtime. Just wondering if I can see how another custom npm package imports + runs to cross reference why this depthkit package canāt be found in the vite build