--watch
should delete destination files on build errors
#3643
Labels
--watch
should delete destination files on build errors
#3643
tldnr;
esbuild --watch
should delete existing destination files in case of build errors, or at minimum have an option to do so.esbuild --watch
is a nice and simple way to insure that changes in source files are reflected in a destination file.Unfortunately, if an error is introduced in a source, an error is logged and the destination file is kept intact, reflecting the sources as they were the last time the build succeeded.
This breaks the contract of reflecting the changes in the sources in the destinations file.
Keeping the destination unchanged makes it much harder for other tools to detect errors. The CLI doesn't offer any way (that I know of) to do anything interesting besides the error logging (and parsing the error log is a terrible option).
One is forced to either use
--serve
and change the way the built assets are accessed (I haven't verified, but I assume the server returns an error code in that case), or else change the build pipeline entirely just so a plugin can be used to do something interesting.The ideal behaviour IMO should be to delete the destination file. If this is deemed unacceptable (e.g. for compatibility reasons), then an option
--delete-on-error
or similar would be a good solution.Thank you for
esbuild
The text was updated successfully, but these errors were encountered: