How to make node.js require absolute? (instead of relative)

And what about:

var myModule = require.main.require('./path/to/module');

It requires the file as if it were required from the main js file, so it works pretty well as long as your main js file is at the root of your project… and that’s something I appreciate.

Leave a Comment