sentry-wizard
sentry-wizard copied to clipboard
Handle case where users use esbuild + `bundle: true`
https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/445#issuecomment-2061371373
We need to solve this case ^
Any thoughts how to solve this? I imagine we'd need to parse some kind of config for this?
I think as a first step, we could ask a question pretty early on "are you using bundle: true"? If so, we redirect to something like the CLI wizard. As a more involved solution we could try parsing the config, however I see that as very difficult since the configs are JS and could have runtime logic we can't statically infer.
Additionally, we could even potentially adjust the esbuild plugin to invoke the CLI with the inject command after the build has finished instead of injecting the debug ids as part of esbuild transpilation. That would definitely be a bit more error prone though.
That would definitely be a bit more error prone though.
Not just error prone but also it would change the integrity hash of the script if change it afterwards. Service workers don't like that stuff xD This is always a problem with CLI inject so I wouldn't do it from within the bundler plugin by default.
But agree, asking is a great first step! Slightly more involved: Have a heuristic that superficially checks for bundle keyword in esbuild config and only ask if it's found?
But agree, asking is a great first step! Slightly more involved: Have a heuristic that superficially checks for
bundlekeyword in esbuild config and only ask if it's found?
Would probably work, but it would run into issues in case the option is "imported" from somewhere else, like inside of a shared config object or something.
hmm yeah you're right, let's just keep it simple 😅