sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

ref(profiling): Conditionally shim cjs globals

Open JonasBa opened this issue 1 year ago • 1 comments

The shims should only be applied if the globals are not present, else it results in double decl and a runtime error. The profiling SDK should gracefully handle env where the shims are already provided.

I couldn't find a way to modify the shim as it is hardcoded in the plugin we are using so I went with the replace plugin approach and a placeholder value #poormansmacros.

Fixes https://github.com/getsentry/sentry-javascript/issues/13259

JonasBa avatar Aug 07 '24 15:08 JonasBa

~I need to add an e2e test before this can be merged~

JonasBa avatar Aug 07 '24 15:08 JonasBa

@AbhiPrasad mind taking another look, I added the check to run experimental modules and bumped to v22 of nodejs for profiling e2e tests

JonasBa avatar Sep 09 '24 16:09 JonasBa

Thanks for the reviews @AbhiPrasad @mydea!

JonasBa avatar Sep 10 '24 13:09 JonasBa