From bfc6b51d955089a7e5b23807b4722cdaec0a8e0b Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 19 Oct 2010 12:01:22 -0700 Subject: [PATCH] The cwdRequire hack is no longer necessary with the require.resolve refactor. --- lib/repl.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index 91a38d49e57..668e7a0d074 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -22,15 +22,6 @@ var context; var disableColors = process.env.NODE_DISABLE_COLORS ? true : false; -function cwdRequire (id) { - if (id.match(/^\.\.\//) || id.match(/^\.\//)) { - id = path.join(process.cwd(), id); - } - return require(id); -} -Object.keys(require).forEach(function (k) { - cwdRequire[k] = require[k]; -}); // hack for require.resolve("./relative") to work properly. module.filename = process.cwd() + "/repl"; @@ -38,7 +29,7 @@ function resetContext() { context = Script.createContext(); for (var i in global) context[i] = global[i]; context.module = module; - context.require = cwdRequire; + context.require = require; }