feat(core): Add SENTRY_RELEASES variable during release injection#102
Merged
Conversation
707d345 to
b463d17
Compare
SENTRY_RELEASES variable during release injection
AbhiPrasad
reviewed
Nov 9, 2022
| const key = org ? `${project}@${org}` : project; | ||
| code += ` | ||
| _global.SENTRY_RELEASES=_global.SENTRY_RELEASES || {}; | ||
| _global.SENTRY_RELEASES["${key}"]={id:"${release}"}; |
Contributor
There was a problem hiding this comment.
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.
Member
Author
There was a problem hiding this comment.
I think that's fair and it would not bloat the bundle unnecessarily for all 99% of users. Will do.
Member
There was a problem hiding this comment.
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.
mydea
approved these changes
Nov 9, 2022
AbhiPrasad
approved these changes
Nov 9, 2022
1b63663 to
ecac791
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.