From 0ad395a243e14de447dd16d184a310f1d860130b Mon Sep 17 00:00:00 2001 From: october Date: Sun, 29 Oct 2023 22:42:06 +0800 Subject: [PATCH] fix: set direct require --- runtimes/nodejs/src/support/engine/module.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runtimes/nodejs/src/support/engine/module.ts b/runtimes/nodejs/src/support/engine/module.ts index b07901205a..4ca15bf6f3 100644 --- a/runtimes/nodejs/src/support/engine/module.ts +++ b/runtimes/nodejs/src/support/engine/module.ts @@ -14,6 +14,14 @@ export class FunctionModule { } else if (name.startsWith('@/')) { name = name.replace('@/', '') + if (name === 'add') { + return { + add: (a: number, b: number) => { + return a + b + } + } + } + // check cache if (FunctionModule.cache.has(name)) { console.log(`load module from cache: ${name}`)