Fix resolution of middleware modules

Fix the code loading "loopback#errorhandler" (for example) to correctly
look up the "loopback" module in node_modules of the bootstrapped
application, instead of looking it up in node_modules of loopback-boot.
This commit is contained in:
Miroslav Bajtoš 2016-10-12 14:36:34 +02:00
parent eeea74e0f7
commit d2d9e8789e
1 changed files with 1 additions and 1 deletions

View File

@ -569,7 +569,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) {
// Try to require the module and check if <module>.<fragment> is a valid
// function
var m = require(pathName);
var m = require(sourceFile);
if (typeof m[fragment] === 'function') {
resolved.sourceFile = sourceFile;
return resolved;