esbuild icon indicating copy to clipboard operation
esbuild copied to clipboard

Warnings as errors

Open willm opened this issue 3 years ago • 1 comments

Apologies if this already a thing that I can't find in the docs, but is it possible to have esbuild not exit 0 when their are warnings? I got caught out today by releasing a bundle that didn't run but the issue was detected by esbuild however CI continued because it passed.

willm avatar Sep 15 '22 16:09 willm

There's no explicit setting for this because I don't think this is a good idea to do in the general case, since esbuild may change warnings from time to time without the expectation that introducing a new warning will break peoples' builds.

You can do this for individual log messages using this feature: https://esbuild.github.io/api/#log-override (by setting the log level to error). That's what I recommend doing.

If you still want to have all warnings stop the build, you can use the JS API instead and then process.exit(1) if there are any warnings.

evanw avatar Sep 15 '22 16:09 evanw

Closing as this question has been answered.

evanw avatar Sep 18 '22 02:09 evanw