admin管理员组

文章数量:1194605

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).

My current configuration

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

Disabling it like described here / did not help.

Any ideas?

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).

My current configuration

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

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

Any ideas?

Share Improve this question edited May 14, 2017 at 10:53 Mihail asked May 14, 2017 at 0:00 MihailMihail 6185 silver badges16 bronze badges 3
  • Looking for an answer to this myself, so adding a bounty. – user578895 Commented Aug 16, 2017 at 16:20
  • You only have react preset in your current configuration which doesn't include transform-regenerator plugin in the first place. – Leonid Beschastny Commented Aug 17, 2017 at 8:45
  • @MarkKahn Well, it would've been better to ask your own question because, as Leonid mentioned, the React preset doesn't include the transform-generator plugin. I'm not sure how'd you'd get the transform-generator plugin in the first place unless you have the env preset or something else. – Andrew Li Commented Aug 19, 2017 at 20:23
Add a comment  | 

1 Answer 1

Reset to default 27 +125

Have you tried "exclude"? Like:

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

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

本文标签: javascriptHow to disable babel transformregenerator completelyStack Overflow