babel-preset-7-esnext

ES.Next transpile preset for babel7 by Harald Rudell

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-preset-7-esnext
1110.0.24 years ago4 years agoMinified + gzip package size for babel-preset-7-esnext in KB

Readme

babel-preset-7-esnext

An ES.Next babel-7 preset connfigurable for targets and ECMAScript modules

© 2018-present Harald Rudell (http://www.haraldrudell.com)

Benefits

  • 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}

link: Hire Harald Rudell

link: Sponsor Harald Rudell

© 2018-present Harald Rudell (http://www.haraldrudell.com)