webpack-bugsnag-plugins icon indicating copy to clipboard operation
webpack-bugsnag-plugins copied to clipboard

Throw an error if no source maps to upload

Open villesau opened this issue 3 years ago • 2 comments

Description

if there is no source maps to upload, the plugin just sits there silently without doing anything.

Describe the solution you'd like

Would be beneficial if there was an error that would be thrown when there is nothing to upload. This would help troubleshooting a lot (in our case, no source maps were generated while I thought it was the plugin that fails). After all, the plugin is used to upload source maps so it should also expect to have something to upload.

villesau avatar Nov 09 '21 16:11 villesau

Hi @villesau

Thanks for the feedback. With the webpack plugin I'm not sure we'd want to fail the build by default as the plugin will be automatically run by webpack as part of the build there may be some legitimate cases where source maps aren't produced.

We'll look into how best to communicate this scenario though, or whether we could have an option to fail the build.

mattdyoung avatar Nov 16 '21 11:11 mattdyoung

@mattdyoung I think there should not be a legitimate reason not to produce source maps if the plugin is in use. If you don't produce source maps you should not use the plugin either. So it is a misconfiguration that should fail the build. If there still is a valid use case for not having source maps and having the plugin, an ecape hatch would be having a toggle to suppress the exception. So I would do it other way around: I'd provide way to bypass the exception, but throw it by default. Though, you could then skip adding the plugin in the first place.

For example we use exactly the same setup for staging & prod, but for staging we do not include the plugin.

villesau avatar Nov 16 '21 15:11 villesau