fix(docker): support .mjs entrypoints in images and e2e

This commit is contained in:
Peter Steinberger
2026-02-06 17:18:10 -08:00
parent 2b6cf03b47
commit 80d42eb0ba
8 changed files with 116 additions and 59 deletions

View File

@@ -11,4 +11,23 @@ if (module.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
}
}
await import("./dist/entry.js");
const tryImport = async (specifier) => {
try {
await import(specifier);
return true;
} catch (err) {
// Only swallow missing-module errors; rethrow real runtime errors.
if (err && typeof err === "object" && "code" in err && err.code === "ERR_MODULE_NOT_FOUND") {
return false;
}
throw err;
}
};
if (await tryImport("./dist/entry.js")) {
// OK
} else if (await tryImport("./dist/entry.mjs")) {
// OK
} else {
throw new Error("openclaw: missing dist/entry.(m)js (build output).");
}