From 60dc6822cff357a1a67480ba52392bc9d9b58479 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 31 Jan 2024 12:41:34 +0100 Subject: [PATCH] Run only once --- packages/server/src/jsRunner.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/server/src/jsRunner.ts b/packages/server/src/jsRunner.ts index 14ad5bedaa..237b97b356 100644 --- a/packages/server/src/jsRunner.ts +++ b/packages/server/src/jsRunner.ts @@ -105,8 +105,10 @@ export function init() { } } + // We need to warp up the actual run in a `cb` function to be able to extract its value from isolated-vm + js = js.replace(/run\(\);$/, "cb(run());") const script = jsIsolate.compileModuleSync( - `import helpers from "compiled_module";${js};cb(run());`, + `import helpers from "compiled_module";${js}`, {} )