I believe the example you are referring to is using requireJS on the client (browser), not running it on the server? To load a javascript in xp serverside you do not need to think about requirejs itself. Simply place the script in the lib directory and load it using require(‘facebook.js’) or similar.