Skip to content

Instantly share code, notes, and snippets.

@hitsujiwool
Created May 28, 2012 03:19
Show Gist options
  • Save hitsujiwool/2817024 to your computer and use it in GitHub Desktop.
Save hitsujiwool/2817024 to your computer and use it in GitHub Desktop.
module autoload in Node.js
var foo = {};
foo.__defineGetter__('bar', function() {
return require('./bar');
});
foo.bar();
module.exports = function() {
console.log('module bar called');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment