vm2-babel-compiler
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

VM2 Babel Compiler

A module for compiling nodejs code with Babel.

Since newer versions of node.js (8 and above) support almost everything natively, this module only uses the @babel/plugin-transform-modules-commonjs plugin to transpile import/export to require and module.exports.

Getting Started

Install:

npm install --save vm2-babel-compiler

A basic usage example:

const compile = require('vm2-babel-compiler');
const compiled = compile(code)

Passing this compiler to VM2:

const { NodeVM } = require("vm2");
const compile = require('vm2-babel-compiler');
 
new NodeVM({
  compile
});

Readme

Keywords

none

Package Sidebar

Install

npm i vm2-babel-compiler

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

2.58 kB

Total Files

5

Last publish

Collaborators

  • idan-at