mirror of https://gitee.com/bigwinds/arangodb
Merge pull request #885 from pluma/require-submodules
Added fallback to allow requiring submodules (fixes #789)
This commit is contained in:
commit
e6d7f438cb
|
@ -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
|
// nothing found
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue