Commit 602e87f5 602e87f5d0abca6b702d3f89bcdb4d9b5023a85e by Nicolas Perriault

fixed patched require() could not open local modules

1 parent 15733d77
...@@ -201,9 +201,12 @@ phantom.loadCasper = function() { ...@@ -201,9 +201,12 @@ phantom.loadCasper = function() {
201 }; 201 };
202 if (phantomBuiltins.indexOf(path) !== -1) { 202 if (phantomBuiltins.indexOf(path) !== -1) {
203 return phantomRequire(path); 203 return phantomRequire(path);
204 } else { 204 }
205 if (path[0] === '.') { 205 if (path[0] === '.') {
206 paths.push(fs.absolute(fs.pathJoin(requireDir, path))); 206 paths.push.apply(paths, [
207 fs.absolute(path),
208 fs.absolute(fs.pathJoin(requireDir, path))
209 ]);
207 } else if (path[0] === '/') { 210 } else if (path[0] === '/') {
208 paths.push(path); 211 paths.push(path);
209 } else { 212 } else {
...@@ -247,7 +250,6 @@ phantom.loadCasper = function() { ...@@ -247,7 +250,6 @@ phantom.loadCasper = function() {
247 } 250 }
248 requireCache[file] = module; 251 requireCache[file] = module;
249 return module.exports; 252 return module.exports;
250 }
251 }; 253 };
252 })(require, phantom.casperPath); 254 })(require, phantom.casperPath);
253 255
......