We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 82813f2 commit a26f7d7Copy full SHA for a26f7d7
1 file changed
lib/repl.js
@@ -17,11 +17,18 @@ var evalcx = process.binding('evals').Script.runInNewContext;
17
var path = require("path");
18
var scope;
19
20
+function cwdRequire (id) {
21
+ if (id.match(/^\.\.\//) || id.match(/^\.\//)) {
22
+ id = path.join(process.cwd(), id);
23
+ }
24
+ return require(id);
25
+}
26
+
27
function setScope (self) {
28
scope = {};
29
for (var i in global) scope[i] = global[i];
30
scope.module = module;
- scope.require = require;
31
+ scope.require = cwdRequire;
32
}
33
34
0 commit comments