fixed patched require() could not open local modules
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -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 | ... | ... |
-
Please register or sign in to post a comment