mirror of
https://github.com/langchain-ai/langgraphjs-api.git
synced 2026-07-19 21:33:46 -04:00
Fix Node 18.x support
This commit is contained in:
@@ -20,10 +20,15 @@ export async function resolve(specifier, context, nextResolve) {
|
||||
// Node.js crashes with "TypeError [ERR_INVALID_URL_SCHEME]: The URL must be of scheme file".
|
||||
// As it already is a valid URI, we can just short-circuit the resolution and avoid `tsx`.
|
||||
if (
|
||||
specifier.includes("@tailwindcss/node/dist/esm-cache.loader.mjs") &&
|
||||
specifier.includes("@tailwindcss/node/dist/esm-cache.loader") &&
|
||||
specifier.startsWith("file://")
|
||||
) {
|
||||
return { shortCircuit: true, url: specifier, format: "module" };
|
||||
return {
|
||||
shortCircuit: true,
|
||||
// Node 18.x will for some reason attempt to load `.mts` instead of `.mjs`
|
||||
url: specifier.replace(".mts", ".mjs"),
|
||||
format: "module",
|
||||
};
|
||||
}
|
||||
|
||||
if (specifier === "@langchain/langgraph-checkpoint") {
|
||||
|
||||
Reference in New Issue
Block a user