fix: stub react-devtools-core for bun compile

Ink statically imports react-devtools-core (only used when DEV=true).
With --external, bun compile leaves a runtime require that fails in the
standalone binary. Instead, provide a no-op stub that bun bundles inline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-26 00:06:31 +00:00
parent 59f0c06b91
commit 414a8d3774
3 changed files with 16 additions and 1 deletions

View File

@@ -19,7 +19,14 @@ pnpm build
echo "==> Bundling standalone binaries..."
mkdir -p dist
rm -f dist/mcpctl dist/mcpctl-local dist/mcpctl-*.rpm
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl --external react-devtools-core
# Ink optionally imports react-devtools-core which isn't installed.
# Provide a no-op stub so bun can bundle it (it's only invoked when DEV=true).
if [ ! -e node_modules/react-devtools-core ]; then
ln -s ../src/cli/stubs/react-devtools-core node_modules/react-devtools-core
fi
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
bun build src/mcplocal/src/main.ts --compile --outfile dist/mcpctl-local
echo "==> Packaging RPM..."

View File

@@ -0,0 +1,2 @@
// Stub for react-devtools-core — not needed in production builds
export default { initialize() {}, connectToDevTools() {} };

View File

@@ -0,0 +1,6 @@
{
"name": "react-devtools-core",
"version": "0.0.0",
"main": "index.js",
"type": "module"
}