From 7470c9bf6f048a988c7019d727c85bc56b833385 Mon Sep 17 00:00:00 2001 From: Oleg Ivaniv Date: Thu, 11 Jan 2024 17:05:15 +0100 Subject: [PATCH 1/2] fix: Add fallback resolver for langchain modules Signed-off-by: Oleg Ivaniv --- packages/@n8n/nodes-langchain/nodes/code/Code.node.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts b/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts index 2a78198234370..1c0f03d641888 100644 --- a/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts +++ b/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts @@ -53,6 +53,12 @@ export const vmResolver = makeResolverFromLegacyOptions({ modules: external ? ['langchain', ...external.split(',')] : ['langchain'], transitive: false, }, + resolve(moduleName, parentDirname) { + if (moduleName.match(/^langchain\//)) { + return require.resolve(`@n8n/n8n-nodes-langchain/node_modules/${moduleName}.cjs`, { paths: [parentDirname] }); + } + return; + }, builtin: builtIn?.split(',') ?? [], }); From 8e9c77ae98ae313e46b10e91bd0931b07c004622 Mon Sep 17 00:00:00 2001 From: Oleg Ivaniv Date: Thu, 11 Jan 2024 17:16:49 +0100 Subject: [PATCH 2/2] :fire: Fix linting issues Signed-off-by: Oleg Ivaniv --- packages/@n8n/nodes-langchain/nodes/code/Code.node.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts b/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts index 1c0f03d641888..a54b982cd8054 100644 --- a/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts +++ b/packages/@n8n/nodes-langchain/nodes/code/Code.node.ts @@ -55,7 +55,9 @@ export const vmResolver = makeResolverFromLegacyOptions({ }, resolve(moduleName, parentDirname) { if (moduleName.match(/^langchain\//)) { - return require.resolve(`@n8n/n8n-nodes-langchain/node_modules/${moduleName}.cjs`, { paths: [parentDirname] }); + return require.resolve(`@n8n/n8n-nodes-langchain/node_modules/${moduleName}.cjs`, { + paths: [parentDirname], + }); } return; },