Skip to content

Commit fd575a3

Browse files
committed
Temporary workaround for Babel issue affecting web-app tests
The Babel plugin `@babel/plugin-transform-regenerator` used in the web-app Jest tests (as part of @babel/preset-env) introduces a bug when transforming this specific minified lightweight built. The issue is that the mangled `ArrayStream` class name (`n` in the specific case) gets wrongly reused and shadowed by a local variable in the `readPacket` function. As a workaround for the problem, and to not have to amend the babel config for each monorepo workspace, we disable mangling the specific class name.
1 parent 479c0af commit fd575a3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rollup.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ const terserOptions = {
5151
compress: {
5252
unsafe: true
5353
},
54+
/**
55+
* The Babel plugin `@babel/plugin-transform-regenerator` used in the web-app Jest tests
56+
* (as part of @babel/preset-env) introduces a bug when transforming the minified lightweight built.
57+
* The issue is that the mangled `ArrayStream` class name (`n` in the specific case) gets wrongly
58+
* reused and shadowed by a local variable in the `readPacket` function (see https://github.com/babel/babel/issues/16334).
59+
* As a workaround for the problem, and to not have to amend the babel config for each monorepo workspace, we disable mangling
60+
* the specific class name.
61+
*/
62+
mangle: { reserved: ['ArrayStream'] },
5463
output: {
5564
comments: '/^(?:!|#__)/',
5665
preserve_annotations: true

0 commit comments

Comments
 (0)