Skip to content

Commit 69ec91c

Browse files
committed
fix: build api CLI as ESM to support trpc-cli
trpc-cli requires ESM with top-level await, which can't be loaded via CommonJS require(). Bundle api.ts separately using esbuild as ESM (.mjs) and use native import() via Function constructor to bypass TypeScript's conversion to require(). Also adds `make mux` target for convenient CLI invocation.
1 parent 1dc4f78 commit 69ec91c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)
111111
mux: ## 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)

0 commit comments

Comments
 (0)