Skip to content

Optylon/babel-preset-latest-node

 
 

Repository files navigation

babel-preset-latest-node NPM version

babel preset latest for node 7 (deprecated), node 8 (latest) or node 6 (LTS)

Dependency ci Status Dependency Status

Alternatives

Options

  • target: 6, 6.5, 7, 7.6, 8, 8.3 or 'current'
  • loose: Enable “loose” transformations for any plugins in this preset that allow them (Disabled by default).
  • modules - Enable transformation of ES6 module syntax to another module type (Enabled by default to "commonjs"). Can be false to not transform modules, or "commonjs"
  • es2016 - Enable es2016 features (Enabled by default)
  • es2017 - Enable es2017 features (Enabled by default)
  • esnext - Enable features in stages but already available in recent node version (Enabled by default)
Feature Node 6 Node 6.5 Node 7 Node 7.6 Node 8 Node 8.3

ES2015

transform-es2015-modules-commonjs no no no no no no
transform-es2015-function-name flag yes yes yes yes yes

ES2016

transform-exponentiation-operator no flag yes yes yes yes

ES2017

syntax-trailing-function-commas no no no no yes yes
transform-async-to-generator no no flag yes yes yes

ESNEXT

transform-object-rest-spread no no no no flag yes

Install

npm install --save-dev babel-preset-latest-node
yarn add --dev babel-preset-latest-node

Usage

Via .babelrc

.babelrc

{
  "presets": ["latest-node"]
}
{
  "presets": [["latest-node", { "target": "current" }]]
}

Via CLI

babel script.js --presets latest-node

Via Node API

require("babel-core").transform("code", {
  presets: [require('babel-preset-latest-node')]
});
require("babel-core").transform("code", {
  presets: [[require('babel-preset-latest-node'), { target: 'current' }]]
});

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.1%
  • Shell 14.9%