if (!pkg || !pkg.main) return false;
var filename = path.resolve(requestPath, pkg.main);
- return tryFile(filename) || tryExtensions(filename, exts);
+ return tryFile(filename) || tryExtensions(filename, exts) ||
+ tryExtensions(path.resolve(filename, 'index'), exts);
}
// In order to minimize unnecessary lstat() calls,
common.debug('test package.json require() loading');
assert.equal(require('../fixtures/packages/main').ok, 'ok',
'Failed loading package');
+assert.equal(require('../fixtures/packages/main-index').ok, 'ok',
+ 'Failed loading package with index.js in main subdir');
common.debug('test cycles containing a .. path');
var root = require('../fixtures/cycles/root'),