babel/packages/babel-plugin-transform-eval
2017-09-26 11:14:41 -04:00
..
2017-06-27 12:15:00 -05:00
2017-03-25 21:46:16 -04:00
2017-09-26 11:14:41 -04:00

babel-plugin-transform-eval

This plugin allows Babel to 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"]
});