Skip to content

Commit

Permalink
refactor: Fix babel warnings rather than silencing them
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Dec 20, 2024
1 parent 9d764e5 commit eb58a42
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/lib/babel-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@ const ESMODULES_TARGET = {
esmodules: true,
};

// silence Babel 7.13+ loose-with-assumptions warnings
const _warn = console.warn;
console.warn = function (m) {
if (/the "loose: true" option/.test(m)) {
return;
}
// eslint-disable-next-line prefer-rest-params
return _warn.apply(this, arguments);
};

const mergeConfigItems = (babel, type, ...configItemsToMerge) => {
const mergedItems = [];

Expand Down Expand Up @@ -116,9 +106,20 @@ export default () => {
'transform-fast-rest',
],
},
// The following 3 plugins have `loose: false` as we instead use the
// associated `assumptions`. Enabling `loose` causes some issues with other
// class features plugins, so we replace it with the assumptions.
{
name: '@babel/plugin-transform-class-properties',
loose: true,
loose: false,
},
{
name: '@babel/plugin-transform-private-property-in-object',
loose: false,
},
{
name: '@babel/plugin-transform-private-methods',
loose: false,
},
!customOptions.modern &&
!isNodeTarget && {
Expand Down

0 comments on commit eb58a42

Please sign in to comment.