From: hyunduk.kim Date: Thu, 20 Aug 2020 02:36:17 +0000 (+0900) Subject: [Addon] Check process type properly when loading addonapi X-Git-Tag: accepted/tizen/unified/20200826.133035~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=10bc4ec93b134abdab5a88b41e5a14fde2d29c6a;p=platform%2Fframework%2Fweb%2Fwrtjs.git [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 --- 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 +}