mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
module: fix regression in require ../
Fixes regression in require system that prevented loading relative
packages via main property in package.json where the file is not
index.{ext}. The regression was introduced in commit 36777d2
.
PR-URL: https://github.com/iojs/io.js/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
0fbe528243
commit
78a7dc2b8f
@ -186,6 +186,10 @@ Module._findPath = function(request, paths) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
filename = tryPackage(basePath, exts);
|
||||
}
|
||||
|
||||
if (!filename) {
|
||||
// try it with each of the extensions at "index"
|
||||
filename = tryExtensions(path.resolve(basePath, 'index'), exts);
|
||||
|
1
test/fixtures/require-bin/bin/req.js
vendored
Normal file
1
test/fixtures/require-bin/bin/req.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('../');
|
1
test/fixtures/require-bin/lib/req.js
vendored
Normal file
1
test/fixtures/require-bin/lib/req.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = '';
|
4
test/fixtures/require-bin/package.json
vendored
Normal file
4
test/fixtures/require-bin/package.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "req",
|
||||
"main": "./lib/req.js"
|
||||
}
|
4
test/simple/test-require-extensions-main.js
Normal file
4
test/simple/test-require-extensions-main.js
Normal file
@ -0,0 +1,4 @@
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
require(common.fixturesDir + '/require-bin/bin/req.js');
|
Loading…
Reference in New Issue
Block a user