Permalink
Browse files

prevent the module from caching

  • Loading branch information...
1 parent ef65d06 commit 222faffc8f213c66d5f333163a1a401f2e48158f @tblobaum committed Dec 6, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 index.js
View
@@ -14,12 +14,17 @@ module.exports = function modulate(dirname, callback) {
if (typeof dirname == 'function') {
var dirname = module.parent.paths[0].split("node_modules")[0]
}
+
var paths = require('findit').sync(dirname)
paths.forEach(function (path) {
- if (!path.match(module.parent.id)) callback(require(path))
+ if (!path.match(module.parent.id)) {
+ var filename = path.split(dirname)[1].split(".js")[0]
+ callback(require(path), filename)
+ }
})
+ delete require.cache[__filename]
}

0 comments on commit 222faff

Please sign in to comment.