From 1e119e690020aa43a8de426fdc5f97dc2460f350 Mon Sep 17 00:00:00 2001 From: Michal Date: Thu, 26 Feb 2026 00:06:31 +0000 Subject: [PATCH] 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 --- scripts/build-rpm.sh | 9 ++++++++- src/cli/stubs/react-devtools-core/index.js | 2 ++ src/cli/stubs/react-devtools-core/package.json | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/cli/stubs/react-devtools-core/index.js create mode 100644 src/cli/stubs/react-devtools-core/package.json diff --git a/scripts/build-rpm.sh b/scripts/build-rpm.sh index 5840453..fd4ee93 100755 --- a/scripts/build-rpm.sh +++ b/scripts/build-rpm.sh @@ -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..." diff --git a/src/cli/stubs/react-devtools-core/index.js b/src/cli/stubs/react-devtools-core/index.js new file mode 100644 index 0000000..bd0c4e7 --- /dev/null +++ b/src/cli/stubs/react-devtools-core/index.js @@ -0,0 +1,2 @@ +// Stub for react-devtools-core — not needed in production builds +export default { initialize() {}, connectToDevTools() {} }; diff --git a/src/cli/stubs/react-devtools-core/package.json b/src/cli/stubs/react-devtools-core/package.json new file mode 100644 index 0000000..5ea6566 --- /dev/null +++ b/src/cli/stubs/react-devtools-core/package.json @@ -0,0 +1,6 @@ +{ + "name": "react-devtools-core", + "version": "0.0.0", + "main": "index.js", + "type": "module" +}