babel-preset-7-esnext

    0.0.2 • Public • Published

    babel-preset-7-esnext

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

    © 2018-present Harald Rudell harald.rudell@gmail.com (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 harald.rudell@gmail.com (http://www.haraldrudell.com)

    Install

    npm i babel-preset-7-esnext

    DownloadsWeekly Downloads

    104

    Version

    0.0.2

    License

    ISC

    Unpacked Size

    7.47 kB

    Total Files

    6

    Last publish

    Collaborators

    • haraldrudell