如何完全禁用Babel变换再生器 [英] How to disable babel transform-regenerator completely

查看:90
本文介绍了如何完全禁用Babel变换再生器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种完全禁用使用babel进行生成器函数转换的方法.对于babel 5,有一个blacklist选项,但似乎对babel 6没有办法(至少我没有在官方网站上找到任何文档).

I'm looking for a way to completely disable generator functions transform with babel. With babel 5 there was a blacklist option, but it seems that with babel 6 there is no way to do that (at least I did not find any documentation on the official website).

我当前的配置

{
  "presets": [
    "react",
  ],
  "plugins": [
    "transform-object-rest-spread",   
  ]
}

如此处所述禁用它 https://babeljs.io/docs/plugins/transform-再生器/没有帮助.

Disabling it like described here https://babeljs.io/docs/plugins/transform-regenerator/ did not help.

有什么想法吗?

推荐答案

您是否尝试过排除"?喜欢:

Have you tried "exclude"? Like:

{
   "presets": [
      ["env", {
         "exclude": ["transform-regenerator"]
      }]
   ]
}

请参阅 https://babeljs.io/docs/plugins/preset-env/#options排除以获取详细信息.

Please see https://babeljs.io/docs/plugins/preset-env/#optionsexclude for details.

这篇关于如何完全禁用Babel变换再生器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆