getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
142 stars 37 forks source link

fix: Allow injection plugins to apply to files with query parameters and fragments in their name #597

Closed Thristhart closed 2 months ago

Thristhart commented 3 months ago

Fixes #596

The previous regex excluded entry points that have query parameters. The common use case for this is content hashes, e.g.:

  output: {
    filename: "[name].js?contenthash=[contenthash]",
  },

The new regex will match the same things as before, but additionally allows those filenames to end with a ? followed by any number of characters. I think this should be fairly safe? The only edge case I can think of is a spacebar heating situation where someone was using the previous behavior to opt out of sentry injection for specific entry points, but that seems unlikely.

lforst commented 2 months ago

Thanks for the contribution, I'd like for this to work consistently across bundlers (esbuild, vite, rollup) before going through with the change so we need to cook a bit more here.

Do you feel like also adjusting the logic for the other bundlers? Otherwise I can take over.

lforst commented 2 months ago

I'd like for this to work consistently across bundlers (esbuild, vite, rollup)

Maybe this is delusional and we can do this iteratively, idk

lforst commented 2 months ago

spacebar heating situation

also: lol

jtbandes commented 4 weeks ago

😮 this definitely seems related to https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/441 – not sure if it resolves it though. (Personally I went with a workaround to #441 so it's not a big deal for me anymore)