-
Couldn't load subscription status.
- Fork 50
feat(core): Add SENTRY_RELEASES variable during release injection
#102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
707d345 to
b463d17
Compare
SENTRY_RELEASES variable during release injection
| const key = org ? `${project}@${org}` : project; | ||
| code += ` | ||
| _global.SENTRY_RELEASES=_global.SENTRY_RELEASES || {}; | ||
| _global.SENTRY_RELEASES["${key}"]={id:"${release}"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: can we make this hidden behind a flag? I'd rather not inject things unnecessarily. I recognize this is a breaking change, but given this is undocumented I'm fine making the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's fair and it would not bloat the bundle unnecessarily for all 99% of users. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, is this something that people could have to opt-in to? If that's easy to do, I would say let people opt in (then, in a hypothetical world where we have a better understanding of which options are set by users, we can take better decisions in the future about this functionality). Seems like it is something pretty specific to want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1b63663 to
ecac791
Compare
In our initial implementation of release injection, we did not inject the
SENTRY_RELEASESglobal variable which was added to the webpack plugin in getsentry/sentry-webpack-plugin#307.Although it is unlikely that people are actually using this feature, it doesn't hurt us a lot if we implement it to prevent breakage for anyone who might manually be relying on this variable (e.g. MFE projects).
EDIT: We decided to make this behaviour opt-in by introducing a new
injectReleasesMapoption.A little more context:
The idea of this variable is to have a map of projects that point to the same release. This seems to be a request for module federation and MFEs where it seems that multiple projects want to access the same release.
This original PR was merged, however it seems like our SDK never reads
SENTRY_RELEASES. The PR author added this in a comment:So what I'm thinking is that this just never happened. This however still means that people could actually be using this feature by manually accessing
global.SENTRY_RELEASESand setting the version based on that.