Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Fix babel warnings rather than silencing them
  • Loading branch information
rschristian committed Dec 20, 2024
commit 6ffd6cee343c236f79c8ea1f0c00ae6c2bd3dc05
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