esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

write:false still gives error: Must use "outdir" when there are multiple input files

Open Paul-Browne opened this issue 2 years ago • 3 comments

not passing a outdir results in a build error: Must use "outdir" when there are multiple input files even when write: false which doesn't really make sense since noting is written to the file system.

Paul-Browne avatar Feb 05 '23 16:02 Paul-Browne

This is needed to compute the output files names. Unless you've noticed, if you have one input then the output file would be called <stdout>.

hyrious avatar Feb 05 '23 17:02 hyrious

I use write: false very often and it always makes me uncomfortable that I'm required to add an outdir.

The value of the outdir can't be an empty string, but also it doesn't need to be a valid directory, so it feels like an unnecessary requirement.

I understand a directory is currently needed to compute the file paths. If this requirement is deeply engrained into the ways things work internally in esbuild, couldn't esbuild create one itself? Could be called buffer or memory for example.

It's not the end of the world, but the act of specifying a directory that will never exist and doesn't even need to be valid is an extra line of code that has the potential of being confusing when reading back in the future.

gusso avatar Nov 19 '23 11:11 gusso

Came across this unexpected case too :)

DenhamPreen avatar Mar 26 '24 10:03 DenhamPreen