Submatter/apps/mcp-server/tsup.config.ts
Randall Stillwell 3e33cab2d6 fix(mcp): keep yaml external in tsup bundle for Docker ESM runtime
Inlining yaml into the MCP ESM bundle caused dynamic require("process") crashes in production. Externalize yaml for mcp-server, orchestrator, and worker builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 22:53:44 -05:00

19 lines
712 B
TypeScript

import { defineConfig } from "tsup";
/** `yaml` uses dynamic require internally and breaks when inlined into ESM. */
const bundledDatabaseExternals = ["yaml"] as const;
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm"],
dts: true,
// Bundle workspace packages into the output so the runtime image doesn't try
// to resolve `@tasks/database` / `@tasks/shared` (which export raw .ts files)
// at import time — Node 20 cannot load .ts. Third-party deps stay external
// and are installed via the regular node_modules layer in the runtime image.
noExternal: [/^@tasks\//],
external: [...bundledDatabaseExternals],
target: "node20",
platform: "node",
clean: true,
});