Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-preset-latest-node

christophehurpeau4kISCdeprecated5.5.1

Use @babel/preset-env or no preset at all

babel preset latest for node 14 (Current), node 12 (Active LTS) node 10 (Maintenance LTS)

babel-preset

readme

babel-preset-latest-node

babel preset latest for node 14 (Current), node 12 (Active LTS) node 10 (Maintenance LTS)

babel 7

Since v2, this package requires @babel/core@^7.0.0. If you use babel 6, you can still use the version "1.0.0" of this package. If you want to migrate, you can read the announcement and the official migration guide.

Alternatives

Options

  • target: 10, 10.13, 12, 12.10, 14 or 'current' (process.versions.node)
  • 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"
  • es2019 - Enable es2019 features (Enabled by default)
  • es2020 - Enable es2020 features (Enabled by default)
  • shippedProposals - Enable features in stages but already available in recent node version (Enabled by default)

Compatibility Table

Feature Node 10 Node 10.13 Node 12 Node 14 Node 14.8

ES2015

| |
transform-modules-commonjs flag flag flag with .mjs with .mjs

ES2019

| |
syntax-optional-catch-binding flag yes yes yes yes
json-strings yes yes yes yes yes

ES2020

| |
nullish-coalescing-operator no no no yes yes
optional-chaining no no no yes yes

Shipped Proposals

| |
numeric-separator no no no yes yes
top-level-await no no no no yes

Note that top level await is syntax only and is only available for supported versions.

Install

npm install --save-dev @babel/core babel-preset-latest-node
yarn add --dev @babel/core 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' }]],
});

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

5.5.1 (2021-03-14)

Bug Fixes

5.5.0 (2021-03-14)

Features

Bug Fixes

  • use proposal-numeric-separator for node < 14 (d50e121)

5.4.0 (2021-01-17)

Features

5.3.0 (2021-01-17)

Features

5.2.0 (2020-12-05)

Features

  • add @babel/plugin-syntax-top-level-await for node 14.8 and higher (47c8c88)

5.1.1 (2020-11-13)

Bug Fixes

5.1.0 (2020-11-13)

Features

  • accept target 12.10 (ed16358)
  • set sideEffects in package.json (9464031)

5.0.0 (2020-09-19)

⚠ BREAKING CHANGES

  • drop target 11 and 13
  • requires latest @babel/core

Features

  • add node 14, es2020 and numeric-separator for shipped proposals (a6437f3)
  • drop target 11 and 13 (5adddfd)

4.0.1 (2019-12-14)

Bug Fixes

  • require default from latest plugins (30708ae)

4.0.0 (2019-12-13)

Features

  • add nullish coalescing operator and optional chaining (f9e89f1)
  • add support for node 12 (212b1b9)
  • drop node 6 and node 8 (5974020)
  • update dependencies (a50d541)

BREAKING CHANGES

  • node 6 and node 8 no longer supported, removed options es2016, es2017, es2018 and esnext (replaced by shippedProposals)

3.2.1 (2019-05-09)

Bug Fixes

3.2.0 (2019-05-09)

Features

  • add es2019 option and plugin-proposal-json-strings in shippedProposals (dfc2534)
  • support node 12 (38037b9)
  • update dependencies (b0d6da8)

3.1.1 (2019-03-12)

Bug Fixes

  • make target option optional (76fdc33), closes #60

3.1.0 (2019-03-09)

Features

3.0.1 (2018-11-23)

3.0.0 (2018-11-23)

Features

BREAKING CHANGES

  • 9 no longer works in target
  • 7 and 7.5 no longer works in target

2.1.0 (2018-11-23)

Features

  • add node 10.13, 11 support and plugin-proposal-optional-catch-binding (2fb4dc9)
  • update plugins deps (e349573)

2.0.2 (2018-08-28)

2.0.1 (2018-08-28)

2.0.0 (2018-08-28)

Features

2.0.0-beta.3 (2018-04-27)

chore

BREAKING CHANGES

  • drop node4 support

2.0.0-beta.2 (2018-04-06)

Bug Fixes

  • async iterators is in the es2018 spec (1ecaaf8)

2.0.0-beta.1 (2018-04-06)

Features

1.0.0 (2018-02-16)

Features

  • add node 9 and rename esnext to shippedProposals (5754ecd)

0.4.0 (2017-08-14)

Features

  • option esnext and node 8.3 (f5a0d17)

0.3.1 (2017-07-09)

0.3.0 (2017-06-22)

Features

  • support node 8, versions as string (a04928c)
  • update dependencies (9915fd2)

0.2.2 (2017-03-21)

Bug Fixes

0.2.1 (2017-03-21)

Bug Fixes

0.2.0 (2017-03-21)

Features

0.1.0 (2017-02-27)

Features