node.codebox module search path
Hey there,
I have an issue when using node.codebox and requiring a module: the search path is not (as expected) the storage location of the maxpatch, but a temp dir of Max. I can see why this makes sense for technical reasons, but it's not useful when working with npm.
Is there a way to change the default search path for a node.codebox? It would be of little use to me to have module path logic in the code itself.
Thanks
Hi Thomas,
Yes, as you point out, node.codebox actually saves the file to a temporary folder for execution, and currently doesn't work well for local npm modules. For node.codebox, you'll need to either just use built in or globally installed node modules, specify the module (or NODE_PATH env var) as an absolute path.
I've made a ticket to investigate handling the module search path resolution in a friendlier way in the future (e.g. use the same folder as the containing patcher).
-Joshua
Thank you Joshua!