So I've made my own module with C++ and node-gyp. Things go fine after node-gyp configure build
and I've got under build/Release
everything I need.
Now, in my other project where I'm using this module, I don't want to add it like
var a = require('../../mylib/build/Release/mylib');
but instead
var a = require('mylib');
after defining dependencies in package.json
. So how do I use npm or something else to achieve this?
You can add the entry point to your package to the main
field in your package.json. This is what will be called when you do require('yourpackage')
.
See these links:
main
in https://npmjs.org/doc/json.html