bugsnag / webpack-bugsnag-plugins

Webpack plugins for common BugSnag actions.
MIT License
32 stars 29 forks source link

More flexible behavior if source map exists instead of error or overwrite #71

Closed mikob closed 2 years ago

mikob commented 2 years ago

Description

Currently, there is an overwrite: boolean field that if false, will throw an error and quit the build, if true, it will overwrite the source map files.

Describe the solution you'd like Overwrite handles 2 out of the 3 possible use cases I can think of. The third missing use case is a soft warning (without overwriting). My usecase which I don't think is uncommon is as follows:

1) Make some changes to fix a bug 2) Make a production build to see if it's fixed (the version has not been upped yet because we don't know what kind of release it will be until we do subsequent changes) 3) Test the production build 4) Make more changes 5) Finally up the versions once we know what's changed for this release 6) A production build where we do upload sourcemaps

Describe alternatives you've considered Completely disabling the plugin manually. This doesn't give me the benefit of a warning that it didn't upload sourcemaps though.

mikob commented 2 years ago

The property could be something like "existsBehavior": "overwrite"|"warning"|"error" instead of overwrite: boolean

mattdyoung commented 2 years ago

Hi @mikob

Thanks for the suggestion, but I think we're unlikely to support this use case. Generally, we'd recommend tagging with a new version every time you build. It's likely to break source mapping on your existing version if you've made code change without changing the version and upload those sourcemaps. So if you're intentionally making code changes without upping the version we'd recommend disabling the plugin altogether for those builds.

A more common pattern would be to tag every version uniquely and perform staging builds, and then promote a staging build to a production build once you're ready to release.