Reputation: 12717
I am using browserify to compile my project along with a few dependencies, however I have noticed that for me to able to require a module inside a file without having to declare its path relatively, like require('mymodule’);
instead of require(‘./mymodule’)
those must live inside the node_modules
directory.
Is it somehow possible to add another path to be resolved when checking for these calls through the command line?
Upvotes: 3
Views: 1058
Reputation: 12158
You must set the NODE_PATH
environment variable.
It works, for example, with your current path instead of node_modules
if you run it like this:
NODE_PATH=. browserify app.js > bundle.js
Upvotes: 4