kopia lustrzana https://github.com/c9/core
fix handling of root modules in setup_paths
rodzic
8a40d404df
commit
5d404b50fe
|
@ -8,13 +8,14 @@ var oldResolve = modules._resolveFilename;
|
||||||
var extraPaths = [
|
var extraPaths = [
|
||||||
__dirname + "/../../"
|
__dirname + "/../../"
|
||||||
];
|
];
|
||||||
modules._resolveFilename = function(request, paths) {
|
modules._resolveFilename = function(request, parent) {
|
||||||
|
if (!parent) parent = { paths: [], filename: "" };
|
||||||
// Ensure client extensions can be loaded
|
// Ensure client extensions can be loaded
|
||||||
request = request.replace(/^lib\//, "node_modules/");
|
request = request.replace(/^lib\//, "node_modules/");
|
||||||
// Add the extra paths
|
// Add the extra paths
|
||||||
extraPaths.forEach(function(p) {
|
extraPaths.forEach(function(p) {
|
||||||
if(paths.paths.indexOf(p) === -1)
|
if (parent.paths.indexOf(p) === -1)
|
||||||
paths.paths.push(p);
|
parent.paths.push(p);
|
||||||
});
|
});
|
||||||
return oldResolve(request, paths);
|
return oldResolve(request, parent);
|
||||||
};
|
};
|
||||||
|
|
Ładowanie…
Reference in New Issue