1
0
Fork 0

Merge pull request #885 from pluma/require-submodules

Added fallback to allow requiring submodules (fixes #789)
This commit is contained in:
Frank Celler 2014-06-03 09:42:48 +02:00
commit e6d7f438cb
1 changed files with 11 additions and 0 deletions

View File

@ -834,6 +834,17 @@ function require (path) {
}
}
// check if there is a package containing this module
path = path.substr(1);
if (path.indexOf('/') !== -1) {
var p = path.split('/');
localModule = requirePackage(currentModule, '/' + p.shift());
if (localModule !== null) {
localModule = requirePackage(localModule, '/' + p.join('/'));
return localModule;
}
}
// nothing found
return null;
}