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:
@@ -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..."
|
||||
|
||||
2
src/cli/stubs/react-devtools-core/index.js
vendored
Normal file
2
src/cli/stubs/react-devtools-core/index.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Stub for react-devtools-core — not needed in production builds
|
||||
export default { initialize() {}, connectToDevTools() {} };
|
||||
6
src/cli/stubs/react-devtools-core/package.json
Normal file
6
src/cli/stubs/react-devtools-core/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "react-devtools-core",
|
||||
"version": "0.0.0",
|
||||
"main": "index.js",
|
||||
"type": "module"
|
||||
}
|
||||
Reference in New Issue
Block a user