jfortunato / esbuild-plugin-manifest

Esbuild plugin for building an asset manifest file.
MIT License
31 stars 5 forks source link

Plugin throwing unnecessary error when build result has errors #12

Closed eddiemf closed 1 year ago

eddiemf commented 1 year ago

When a build result contains errors it also doesn't include the metafile object in it, which makes the plugin throw an Expected metafile, but it does not exist. error.

This is quite annoying because every time there's a mistake in code in watch mode it pollutes the entire console with this error, instead of showing only the actual code error.

I think a simple solution would be to simply return early if result.errors.length is truthy, and then if there are no errors but still metafile is missing we can throw that error.

After such change it shows only the code error as expected.

jfortunato commented 1 year ago

Thanks for reporting @eddiemf. Starting with v0.6.0 this should be fixed now.