esbuild
esbuild copied to clipboard
write:false still gives error: Must use "outdir" when there are multiple input files
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.
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>
.
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.
Came across this unexpected case too :)