fix(build): Prevent Rollup from adding [Symbol.toStringTag]: 'Module'
to CJS files
#6043
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.
As of version 2.69.0, setting
output.generatedCode
to'es2015'
(as we do) causes Rollup to add[Symbol.toStringTag]: 'Module'
to generated CJS files. Though this is valid ES6, it causes Jest to be unable to mock our generated packages.Though a PR has been opened to fix this, the change almost certainly won't be backported, so anyone using Jest 29.2.2 or under will run into this problem if they try to mock
@sentry/xxx
7.16. (The relevant change was introduced in #5951, when we (semi-)accidentally upgraded Rollup from 2.67.1 to 2.78.0, and was first included in version 7.16.)This PR prevents the new Rollup behavior, since it has no known benefit. (The Rollup docs say that presence of the
'Module'
toStringTag "is used for feature detection in certain libraries and frameworks," but not having it hasn't seemed to hurt us so far.)Fixes #5994.
Fixes #6037.