fix: Add fallback resolver for langchain modules (#8308)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg 2024-01-12 18:33:33 +01:00 committed by GitHub
parent 63b738a542
commit 851060dd3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(',') ?? [],
});