Stop doing eval to load server add-ons

Summary:
Closes https://github.com/facebook/flipper/issues/4203

CHANGELOG: Stop doing eval to load server add-ons

On Windows `details.path`  contains backslashes. When we interpolate it, it loses one of the backslashes and subsequently `require` fails to load it. If we do not interpolate it (by ditching eval) it has the double backslash and work just fine.

Reviewed By: lblasa

Differential Revision: D40715523

fbshipit-source-id: 50c52f2a53690b585a32d3009f1692cf0b0d8428
This commit is contained in:
Andrey Goncharov
2022-10-26 05:00:00 -07:00
committed by Facebook GitHub Bot
parent 3e88a53a3f
commit b025cda861
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,6 @@ export const loadServerAddOn = (
`loadPlugin -> server add-on path is empty plugin ${pluginName}.`, `loadPlugin -> server add-on path is empty plugin ${pluginName}.`,
); );
// eslint-disable-next-line no-eval const serverAddOnModule = electronRequire(details.path);
const serverAddOnModule = eval(`require("${details.path}")`);
return serverAddOnModule; return serverAddOnModule;
}; };

View File

@@ -8,7 +8,8 @@
"../types/JSONStream", "../types/JSONStream",
"../types/adbkit", "../types/adbkit",
"../types/openssl-wrapper", "../types/openssl-wrapper",
"../types/adbkit-logcat" "../types/adbkit-logcat",
"../types/flipperGlobals"
] ]
}, },
"references": [ "references": [