Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Forked from mediaupstream/foo.js
Created August 15, 2012 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TooTallNate/3364320 to your computer and use it in GitHub Desktop.
Save TooTallNate/3364320 to your computer and use it in GitHub Desktop.
Recursive require crashes node
module.exports = foo;
require('./index.js')();
function foo(){
console.log('foo.js', Date.now() );
}
module.exports = index;
require('./foo.js')();
function index(){
console.log('index.js', Date.now());
}
@mediaupstream
Copy link

How can I do this:

module.exports = index;

require('./foo.js')();

var index = function(){
  console.log('index.js', Date.now());
}

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