From b43b1556c0e519b938dd3111e73085c995222074 Mon Sep 17 00:00:00 2001 From: suraj-markup Date: Mon, 2 Mar 2026 02:44:19 +0530 Subject: [PATCH] fix: check core dist output instead of .next/BUILD_ID in checkBuilt .next/BUILD_ID only exists after next build (production) but the dashboard runs with next dev. Check @composio/ao-core resolve instead, which is the actual cause of module resolution errors when packages are not compiled. Co-Authored-By: Claude Opus 4.6 --- packages/cli/src/lib/preflight.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/lib/preflight.ts b/packages/cli/src/lib/preflight.ts index faaa5e451..c424759e3 100644 --- a/packages/cli/src/lib/preflight.ts +++ b/packages/cli/src/lib/preflight.ts @@ -9,7 +9,8 @@ import { existsSync } from "node:fs"; import { resolve } from "node:path"; -import { isPortAvailable, findWebDir } from "./web-dir.js"; +import { createRequire } from "node:module"; +import { isPortAvailable } from "./web-dir.js"; import { exec } from "./shell.js"; /** @@ -26,13 +27,17 @@ async function checkPort(port: number): Promise { } /** - * Check that packages have been built (the web .next directory exists). - * Throws if not built. + * Check that workspace packages have been compiled (TypeScript → JavaScript). + * Verifies @composio/ao-core dist output exists, since a missing dist/ is the + * actual cause of module resolution errors when starting the dashboard. + * Works with both `next dev` and `next build` (unlike .next/BUILD_ID which + * is production-only). */ async function checkBuilt(): Promise { - const webDir = findWebDir(); - const buildId = resolve(webDir, ".next", "BUILD_ID"); - if (!existsSync(buildId)) { + const require = createRequire(import.meta.url); + try { + require.resolve("@composio/ao-core"); + } catch { throw new Error("Packages not built. Run: pnpm build"); } }