Created
July 2, 2016 20:32
-
-
Save codewithpassion/8dc5a98e10df262bf6162938ade3ddb0 to your computer and use it in GitHub Desktop.
NodeJS require
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// To eliminate hard coding paths for require, we are modifying the NODE_PATH to include our lib folder | |
var oldpath = ''; | |
if( process.env[ 'NODE_PATH' ] !== undefined ) | |
{ | |
oldpath = process.env[ 'NODE_PATH' ]; | |
} | |
// Append modules directory to path | |
process.env['NODE_PATH'] = __dirname + '/:' + __dirname + "/src/:" + oldpath; | |
require('module').Module._initPaths(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment