Here’s a minimal Makefile for transforming JS with esbuild
js_files := $(shell find src -name "*.js" -print)
js_targets := $(addprefix dist/, $(js_files))
.PHONY: js
js: $(js_targets)
dist/%.js: %.js
@npx esbuild $? $(FLAGS) --outfile=$@ --format=esm --log-level=error