From d2d9e8789e3ce6525fcaf97f4573947293b23121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 12 Oct 2016 14:36:34 +0200 Subject: [PATCH] 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. --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 7258e6a..614d76e 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -569,7 +569,7 @@ function resolveMiddlewarePath(rootDir, middleware, config) { // Try to require the module and check if . is a valid // function - var m = require(pathName); + var m = require(sourceFile); if (typeof m[fragment] === 'function') { resolved.sourceFile = sourceFile; return resolved;