Skip to content

Commit d3324f4

Browse files
committed
prevent rollup from adding [Symbol.toStringTag]: 'Module' to CJS files
1 parent fe1a22c commit d3324f4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rollup/npmHelpers.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ export function makeBaseNPMConfig(options = {}) {
4444
// output individual files rather than one big bundle
4545
preserveModules: true,
4646

47-
// any wrappers or helper functions generated by rollup can use ES6 features
48-
generatedCode: 'es2015',
47+
// Allow wrappers or helper functions generated by rollup to use any ES6 features except symbols. (Symbols in
48+
// general are fine, but the `[Symbol.toStringTag]: 'Module'` which Rollup adds alongside `__esModule:
49+
// true` in CJS modules makes it so that Jest <= 29.2.2 crashes when trying to mock generated `@sentry/xxx`
50+
// packages. See https://github.com/getsentry/sentry-javascript/pull/6043.)
51+
generatedCode: {
52+
preset: 'es2015',
53+
symbols: false,
54+
},
4955

5056
// don't add `"use strict"` to the top of cjs files
5157
strict: false,

0 commit comments

Comments
 (0)