From 10bc4ec93b134abdab5a88b41e5a14fde2d29c6a Mon Sep 17 00:00:00 2001 From: "hyunduk.kim" Date: Thu, 20 Aug 2020 11:36:17 +0900 Subject: [PATCH] [Addon] Check process type properly when loading addonapi In checking the condition to handle the path for addonapi when require('addonapi') is called, it needs to check the process type to know which process calls the module. However, there's improper condition for process type. That makes it unable to use addonapi regardless of process type. This changes the condition so it can use addonapi when the process type is valid. Change-Id: I8c58c5f8d98041c2e21ce970b7a5a1ab927f8cf6 Signed-off-by: hyunduk.kim --- wrt_app/common/config-search-paths.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrt_app/common/config-search-paths.ts b/wrt_app/common/config-search-paths.ts index 080fae8..20be308 100644 --- a/wrt_app/common/config-search-paths.ts +++ b/wrt_app/common/config-search-paths.ts @@ -5,8 +5,8 @@ import * as path from 'path'; const originalResolveFilename = Module._resolveFilename; Module._resolveFilename = function (request: string, parent: NodeModule, isMain: boolean) { - if (request === 'addonapi' && !process.type) + if (request === 'addonapi' && process.type) return path.join(__dirname, '..', 'addon', process.type as string, 'addonapi.js'); else return originalResolveFilename(request, parent, isMain); -} \ No newline at end of file +} -- 2.7.4