Fix Node 18.x support

This commit is contained in:
Tat Dat Duong
2025-03-14 22:47:56 +01:00
parent 4896359408
commit 89367f2bcf
+7 -2
View File
@@ -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") {