2017-10-27 11:50:59 -04:00

621 B

@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": ["@babel/transform-eval"]
}

Via CLI

babel --plugins @babel/transform-eval script.js

Via Node API

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