Npmdef with dependency on another npmdef?

I am working on a project with most of the code in one npmdef, I have another npmdef I have made that references a script in another npdmdef, is there a way to add a dependency between the two?

Original Post on Discord

by user 103054507105067008

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

Yes - but currently not directly from unity (not via an editor integration). You can install it via e.g. terminal / commandline if you open the package of npmdef1 and run npm i "path/to/other/npmdef" (is one option) - that’s basically what we also do when you dragdrop an npmdef to your exportinfo component: we add its name and local path in the package.json and run install (what technically happens is that windows or mac will then create a symlink to that npm package in the node_modules folder)

Thats if both are always local.
Alternatively you can publish one or both to a registry and run install via npm i package-name (in the npm package folder) where package name is the name of your second npmdef/npm package (the name in the package.json name field)

Both options are the same as with any package in a nodejs/npm context (same as with when you install a dependency to your web project)

Thanks will try that here, marking as answered. I wonder if there is some editor way to link them up nicely in the future but for now this is what I need :slightly_smiling_face:

by user 103054507105067008

In the future: maybe, but demand was low (you’re the first one asking for it) so it wasnt a priority (and it’s relatively easy to do without an integration and a relative advanced usecase)