evanw / esbuild

An extremely fast bundler for the web
https://esbuild.github.io/
MIT License
38.21k stars 1.15k forks source link

fix running esbuild cli with deno #3917

Closed Joshix-1 closed 2 months ago

Joshix-1 commented 2 months ago

The problem:

$ deno --version
deno 1.46.3 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.5-rusty
typescript 5.5.2
$ deno run -A https://deno.land/x/esbuild@v0.23.1/mod.js > /dev/null
error: Uncaught (in promise) TypeError: stdin is not piped
  const writer = child.stdin.getWriter();
                       ^
    at ChildProcess.get stdin (ext:runtime/40_process.js:243:13)
    at spawnNew (https://deno.land/x/esbuild@v0.23.1/mod.js:1712:24)
    at https://deno.land/x/esbuild@v0.23.1/mod.js:1872:3
    at eventLoopTick (ext:core/01_core.js:169:7)

Relevant deno docs: https://docs.deno.com/api/deno/~/Deno.Command This means getWriter/getReader can only be called if stdin/stdout are piped.

evanw commented 2 months ago

Thanks for the report. It looks like Deno broke this API in Deno version 1.31.0 as far as I can tell. This code was working fine with Deno version 1.30.0.