In a PhantomJS script I would like to load a custom module but it seems relative paths do not works in PhantomJS ?
script.js:
var foo = require(\'./scrip
To load your own module, the right way to do it is to use module.exports, like this: foo.js
function bar(text) { console.log(text); } exports.bar = bar
And in script.js (which is executed with phantomjs script.js):
var foo = require('./script/lib/foo'); foo.bar('hello world'); phantom.exit();