You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I can try to do this but I imagine it could trip people up if it's unexpected. So it seems like a good idea to wait until the next breaking change release to make this change.
You can see for yourself here: https://github.com/evanw/esbuild/releases. I have no set schedule around breaking change releases and make no commitment to when they will happen. I try to batch breaking changes together to avoid disrupting people too much by doing breaking changes all the time. The breaking label helps me keep track of these for the next batch of them.
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: