Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created July 15, 2012 16:30
Show Gist options
  • Save isaacs/3117649 to your computer and use it in GitHub Desktop.
Save isaacs/3117649 to your computer and use it in GitHub Desktop.
console.log('in bar')
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')
$ node foo.js
failure first time
in bar
worked
@isaacs
Copy link
Author

isaacs commented Jul 15, 2012

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment