从 "metro-react-native-babel-preset" 中排除“@babel/plugin-transform-regenerator”

Exclude "@babel/plugin-transform-regenerator" from "metro-react-native-babel-preset"

我正在使用 metro-react-native-babel-preset,但我需要排除 @babel/plugin-transform-regenerator。我尝试了各种各样的事情,但没有任何效果。我怀疑问题是 metro-react-native-babel-preset 直接需要插件,如下所示:

///node_modules/metro-react-native-babel-preset/src/configs/main.js

          plugins: [
          ...defaultPluginsBeforeRegenerator,
          isHermes ? null : require("@babel/plugin-transform-regenerator"),
          ...defaultPluginsAfterRegenerator
        ].filter(Boolean)

有什么方法可以禁用此插件但继续使用 metro 预设吗?

我当前的配置如下所示:

const babelOptions = {presets: [['module:metro-react-native-babel-preset', {exclude: ['regenerator-transform']}]], 
module.exports = require('babel-jest').createTransformer(babelOptions);

谢谢!

最近 metro-preset 它已被删除

https://github.com/facebook/metro/releases/tag/v0.70.0