Skip to content

Commit eb58a42

Browse files
committed
refactor: Fix babel warnings rather than silencing them
1 parent 9d764e5 commit eb58a42

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/lib/babel-custom.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ const ESMODULES_TARGET = {
77
esmodules: true,
88
};
99

10-
// silence Babel 7.13+ loose-with-assumptions warnings
11-
const _warn = console.warn;
12-
console.warn = function (m) {
13-
if (/the "loose: true" option/.test(m)) {
14-
return;
15-
}
16-
// eslint-disable-next-line prefer-rest-params
17-
return _warn.apply(this, arguments);
18-
};
19-
2010
const mergeConfigItems = (babel, type, ...configItemsToMerge) => {
2111
const mergedItems = [];
2212

@@ -116,9 +106,20 @@ export default () => {
116106
'transform-fast-rest',
117107
],
118108
},
109+
// The following 3 plugins have `loose: false` as we instead use the
110+
// associated `assumptions`. Enabling `loose` causes some issues with other
111+
// class features plugins, so we replace it with the assumptions.
119112
{
120113
name: '@babel/plugin-transform-class-properties',
121-
loose: true,
114+
loose: false,
115+
},
116+
{
117+
name: '@babel/plugin-transform-private-property-in-object',
118+
loose: false,
119+
},
120+
{
121+
name: '@babel/plugin-transform-private-methods',
122+
loose: false,
122123
},
123124
!customOptions.modern &&
124125
!isNodeTarget && {

0 commit comments

Comments
 (0)