// Bundles the shared ui/src/lib game-image renderer (see src/entry.ts) into // dist/gameimage.mjs for the sidecar runtime. Uses the esbuild JS API — the CLI shim is // unreliable under pnpm's bin wrapper (it re-runs the native binary through node). import { build } from 'esbuild'; await build({ entryPoints: ['src/entry.ts'], bundle: true, format: 'esm', platform: 'node', outfile: 'dist/gameimage.mjs', // The shared ui/src/lib modules are copied without their node_modules, so a bare npm import they // make (offer.ts → 'marked', the offer renderer's markdown parser) is not resolvable from the ui // tree. NODE_PATH-style fallback to the renderer's own node_modules, where marked is a dependency. nodePaths: ['node_modules'], logLevel: 'info', });