Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created October 14, 2011 12:27
Show Gist options
  • Save aseemk/1286967 to your computer and use it in GitHub Desktop.
Save aseemk/1286967 to your computer and use it in GitHub Desktop.
Weird/wrong order of execution when require()-ing things in Node v0.4.5
console.log(Date.now() + ' requiring coffee-script...');
require('coffee-script');
console.log(Date.now() + ' requiring streamline...');
require('streamline');
console.log(Date.now() + ' requiring custom...');
require('./custom');
// this is at the top of the file registered as "main" in package.json
console.log(Date.now() + ' coffee-script executing...');
// ...
// this is at the top of the file registered as "main" in package.json
console.log(Date.now() + ' streamline executing...');
// ...
console.log Date.now() + ' custom executing...'
# ...
1318595095620 requiring coffee-script...
1318595095658 requiring streamline...
1318595095706 requiring custom...
1318595095715 custom executing...
1318595095784 coffee-script executing...
1318595095824 streamline executing...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment