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:
parent
eeea74e0f7
commit
d2d9e8789e
|
@ -569,7 +569,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) {
|
||||||
|
|
||||||
// Try to require the module and check if <module>.<fragment> is a valid
|
// Try to require the module and check if <module>.<fragment> is a valid
|
||||||
// function
|
// function
|
||||||
var m = require(pathName);
|
var m = require(sourceFile);
|
||||||
if (typeof m[fragment] === 'function') {
|
if (typeof m[fragment] === 'function') {
|
||||||
resolved.sourceFile = sourceFile;
|
resolved.sourceFile = sourceFile;
|
||||||
return resolved;
|
return resolved;
|
||||||
|
|
Loading…
Reference in New Issue