Skip to content

Commit

Permalink
fix: Add fallback resolver for langchain modules (#8308)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Ivaniv <[email protected]>
  • Loading branch information
OlegIvaniv authored and netroy committed Jan 16, 2024
1 parent 371d0ae commit 82199f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/@n8n/nodes-langchain/nodes/code/Code.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ 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(',') ?? [],
});

Expand Down

0 comments on commit 82199f4

Please sign in to comment.