Browse files

Make the repl respect node_modules folders.

This is important so that in the future, this will work:

    $ cd ~/dev/js/some-project
    $ npm install redis
    $ node
    > require.resolve('redis')
    '/Users/isaacs/dev/js/some-project/node_modules/redis/index.js'
  • Loading branch information...
1 parent fe83861 commit f07041e6cd26b3e3617deccf6d8df86cb7c9d750 @isaacs isaacs committed with ry Feb 11, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/repl.js
View
3 lib/repl.js
@@ -36,6 +36,9 @@ if (process.platform != 'win32') {
// hack for require.resolve("./relative") to work properly.
module.filename = process.cwd() + '/repl';
+// hack for repl require to work properly with node_modules folders
+module.paths = require('module')._nodeModulePaths(module.filename);
+
function resetContext() {
context = vm.createContext();

0 comments on commit f07041e

Please sign in to comment.