babel-preset-7-esnext
An ES.Next babel-7 preset connfigurable for targets and ECMAScript modules
harald.rudell@gmail.com (http://www.haraldrudell.com)
© 2018-present Harald RudellBenefits
- Get ES.Next in a single package
- Configurable transpilation-level: light to Node.js 8.5
- Configurable transpile to CommonJS
Usage
yarn add --dev babel-preset-7-esnext @babel/core
import presetEsNext from 'babel-preset-7-esnext'
import {transform} from '@babel/core'
f("import path from 'path'\nexport {path}").catch(console.error)
async function f(code) {
console.log(await new Promise((resolve, reject) => transform(code,
{configFile: false, babelrc: false, presets: [presetEsNext]},
(e, result) => !e ? resolve(result) : reject(e)
)))
console.log(await new Promise((resolve, reject) => transform(code,
{configFile: false, babelrc: false, presets: [[presetEsNext, {env: {targets: {node: true}, modules: false}}]]},
(e, result) => !e ? resolve(result) : reject(e)
)))
}
Options
- env: options to @babel/preset-env, default {targets: {node: true}}
- decorators: options to @babel/plugin-proposal-decorators, default {decoratorsBeforeExport: false}
Hire Harald Rudell
link:Sponsor Harald Rudell
link: