W3cubDocs

/Babel

Eval transform

Compile eval calls with string literals

Example

In

eval("(() => 'foo')");

Out

eval("(function () { return 'foo'; })");

Installation

npm install --save-dev babel-plugin-transform-eval

Usage

.babelrc

{
  "plugins": ["transform-eval"]
}

Via CLI

babel --plugins transform-eval script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-eval"]
});

© 2018 Sebastian McKenzie
Licensed under the MIT License.
http://babeljs.io/docs/plugins/transform-eval/