when I try to load a js file using require in node I get the error Cannot find module 'http://example.com'. This is the code I am trying to execute,
var content = require(`http://example.com`);
content.run();
So basically am I doing something wrong or is require able to load files that are online?
You could try downloading the file, then using require to include it once the download completes.
But really, if it's at all possible, you should download the file yourself so you know it's what you expect it to be. Running code from an external server always carries extra risk.