diff --git a/index.js b/index.js
index <HASH>..<HASH> 100644
--- a/index.js
+++ b/index.js
@@ -61,9 +61,14 @@ module.exports = function hook (modules, options, onrequire) {
       }
     }
 
-    if (hook.cache[filename]) return exports // abort if module have already been processed
-    hook.cache[filename] = exports
+    // only call onrequire the first time a module is loaded
+    if (!hook.cache.hasOwnProperty(filename)) {
+      // ensure that the cache entry is assigned a value before calling
+      // onrequire, in case calling onrequire requires the same module.
+      hook.cache[filename] = exports
+      hook.cache[filename] = onrequire(exports, name, basedir)
+    }
 
-    return onrequire(exports, name, basedir)
+    return hook.cache[filename]
   }
 }
diff --git a/test/test.js b/test/test.js
index <HASH>..<HASH> 100644
--- a/test/test.js
+++ b/test/test.js
@@ -93,6 +93,19 @@ test('cache', function (t) {
   t.end()
 })
 
+test('replacement value', function (t) {
+  var replacement = {}
+
+  hook(['url'], function (exports, name, basedir) {
+    return replacement
+  })
+
+  t.deepEqual(require('url'), replacement)
+  t.deepEqual(require('url'), replacement)
+
+  t.end()
+})
+
 test('circular', function (t) {
   t.plan(2)
Make cache value replaceable (#2)