var babel = require("@babel/core"); import { transform } from "@babel/core"; import * as babel from "@babel/core"; All transformations will use your local configuration files. transform babel.transform(code: string, options?: Object, callback: Function) Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST.