Created
July 15, 2012 16:30
-
-
Save isaacs/3117649 to your computer and use it in GitHub Desktop.
Reply to: https://gist.github.com/3115640
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
console.log('in bar') |
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
try { | |
require('bar.js') | |
console.log('success first time') | |
} catch (e) { | |
console.error('failure first time') | |
} | |
module.paths.push(__dirname) | |
require('bar.js') | |
console.log('worked') | |
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
$ node foo.js | |
failure first time | |
in bar | |
worked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This should not be done. It's a design goal to make local requires obviously different from "outside the package" requires (either builtin modules or package deps.)