diff --git a/scripts/tsdown-build.mjs b/scripts/tsdown-build.mjs index 09978543bdd..5faa9799dbb 100644 --- a/scripts/tsdown-build.mjs +++ b/scripts/tsdown-build.mjs @@ -5,6 +5,7 @@ import { spawnSync } from "node:child_process"; const logLevel = process.env.OPENCLAW_BUILD_VERBOSE ? "info" : "warn"; const extraArgs = process.argv.slice(2); const INEFFECTIVE_DYNAMIC_IMPORT_RE = /\[INEFFECTIVE_DYNAMIC_IMPORT\]/; +const UNRESOLVED_IMPORT_RE = /\[UNRESOLVED_IMPORT\]/; const result = spawnSync( "pnpm", ["exec", "tsdown", "--config-loader", "unrun", "--logLevel", logLevel, ...extraArgs], @@ -31,6 +32,13 @@ if (result.status === 0 && INEFFECTIVE_DYNAMIC_IMPORT_RE.test(`${stdout}\n${stde process.exit(1); } +if (result.status === 0 && UNRESOLVED_IMPORT_RE.test(`${stdout}\n${stderr}`)) { + console.error( + "Build emitted [UNRESOLVED_IMPORT]. Declare or bundle the missing dependency instead of silently externalizing it.", + ); + process.exit(1); +} + if (typeof result.status === "number") { process.exit(result.status); }