@@ -109,7 +109,7 @@ rebuild-native: node_modules/.installed ## Rebuild native modules (node-pty) for
109109
110110# Run compiled CLI with trailing arguments (builds only if missing)
111111mux : # # Run the compiled mux CLI (e.g., make mux server --port 3000)
112- @test -f dist/cli/index.js || $(MAKE ) build-main
112+ @test -f dist/cli/index.js -a -f dist/cli/api.mjs || $(MAKE ) build-main
113113 @node dist/cli/index.js $(filter-out $@ ,$(MAKECMDGOALS ) )
114114
115115# Catch unknown targets passed to mux (prevents "No rule to make target" errors)
@@ -128,16 +128,18 @@ help: ## Show this help message
128128# # Development
129129ifeq ($(OS ) ,Windows_NT)
130130dev : node_modules/.installed build-main # # Start development server (Vite + nodemon watcher for Windows compatibility)
131- @echo " Starting dev mode (2 watchers: nodemon for main process, vite for renderer)..."
131+ @echo " Starting dev mode (3 watchers: nodemon for main process, esbuild for api , vite for renderer)..."
132132 # On Windows, use npm run because bunx doesn't correctly pass arguments to concurrently
133133 # https://github.com/oven-sh/bun/issues/18275
134134 @NODE_OPTIONS=" --max-old-space-size=4096" npm x concurrently -k --raw \
135135 " bun x nodemon --watch src --watch tsconfig.main.json --watch tsconfig.json --ext ts,tsx,json --ignore dist --ignore node_modules --exec node scripts/build-main-watch.js" \
136+ " npx esbuild src/cli/api.ts --bundle --format=esm --platform=node --outfile=dist/cli/api.mjs --external:zod --external:commander --external:@trpc/server --watch" \
136137 " vite"
137138else
138139dev : node_modules/.installed build-main build-preload # # Start development server (Vite + tsgo watcher for 10x faster type checking)
139140 @bun x concurrently -k \
140141 " bun x concurrently \" $( TSGO) -w -p tsconfig.main.json\" \" bun x tsc-alias -w -p tsconfig.main.json\" " \
142+ " bun x esbuild src/cli/api.ts --bundle --format=esm --platform=node --outfile=dist/cli/api.mjs --external:zod --external:commander --external:@trpc/server --watch" \
141143 " vite"
142144endif
143145
@@ -151,6 +153,7 @@ dev-server: node_modules/.installed build-main ## Start server mode with hot rel
151153 @# On Windows, use npm run because bunx doesn't correctly pass arguments
152154 @npmx concurrently -k \
153155 " npmx nodemon --watch src --watch tsconfig.main.json --watch tsconfig.json --ext ts,tsx,json --ignore dist --ignore node_modules --exec node scripts/build-main-watch.js" \
156+ " npx esbuild src/cli/api.ts --bundle --format=esm --platform=node --outfile=dist/cli/api.mjs --external:zod --external:commander --external:@trpc/server --watch" \
154157 " npmx nodemon --watch dist/cli/index.js --watch dist/cli/server.js --delay 500ms --exec \" node dist/cli/index.js server --host $( or $( BACKEND_HOST) ,localhost) --port $( or $( BACKEND_PORT) ,3000) \" " \
155158 " $( SHELL) -lc \" MUX_VITE_HOST=$( or $( VITE_HOST) ,127.0.0.1) MUX_VITE_PORT=$( or $( VITE_PORT) ,5173) VITE_BACKEND_URL=http://$( or $( BACKEND_HOST) ,localhost) :$( or $( BACKEND_PORT) ,3000) vite\" "
156159else
@@ -162,6 +165,7 @@ dev-server: node_modules/.installed build-main ## Start server mode with hot rel
162165 @echo " For remote access: make dev-server VITE_HOST=0.0.0.0 BACKEND_HOST=0.0.0.0"
163166 @bun x concurrently -k \
164167 " bun x concurrently \" $( TSGO) -w -p tsconfig.main.json\" \" bun x tsc-alias -w -p tsconfig.main.json\" " \
168+ " bun x esbuild src/cli/api.ts --bundle --format=esm --platform=node --outfile=dist/cli/api.mjs --external:zod --external:commander --external:@trpc/server --watch" \
165169 " bun x nodemon --watch dist/cli/index.js --watch dist/cli/server.js --delay 500ms --exec 'NODE_ENV=development node dist/cli/index.js server --host $( or $( BACKEND_HOST) ,localhost) --port $( or $( BACKEND_PORT) ,3000) '" \
166170 " MUX_VITE_HOST=$( or $( VITE_HOST) ,127.0.0.1) MUX_VITE_PORT=$( or $( VITE_PORT) ,5173) VITE_BACKEND_URL=http://$( or $( BACKEND_HOST) ,localhost) :$( or $( BACKEND_PORT) ,3000) vite"
167171endif
0 commit comments