Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable babel transform-regenerator completely

Tags:

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?

like image 956
Mihail Avatar asked May 14 '17 00:05

Mihail


People also ask

What does Babel transform runtime do?

A plugin that enables the re-use of Babel's injected helper code to save on codesize.

What is Babel transform?

Babel is a JavaScript compilerTransform syntax. Polyfill features that are missing in your target environment (through a third-party polyfill such as core-js) Source code transformations (codemods) And more!

What is a Babelrc file?

The . babelrc file is your local configuration for your code in your project. Generally you would put it in the root of your application repo. It will affect all files that Babel processes that are in the same directory or in sibling directories of the . babelrc .

What is Babel config js in react native?

React Native itself uses this Babel preset by default when transforming your app's source code. If you wish to use a custom Babel configuration by writing a babel. config. js file in your project's root directory, you must specify all the plugins necessary to transform your code.


1 Answers

Have you tried "exclude"? Like:

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

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

like image 141
VHao Avatar answered Sep 26 '22 03:09

VHao