babel-preset-node8

Babel preset for Node 7.10-8

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-preset-node8
811.2.07 years ago7 years agoMinified + gzip package size for babel-preset-node8 in KB

Readme

babel-preset-node8

Babel 6+ presets for Node 7.10-8.x

Node v7.10 comes with native support of async/await. This preset for Babel 6 adds some remaining features. Also plugin has plugins to build production-ready "fast" code.

Included plugins

Plugins in env.production

Installation

npm install --save-dev babel-preset-node8

Usage

Via .babelrc (recommended)

Create a .babelrc file in your project root, and include node8 in your presets list.
{
  "presets": ["node8"]
}
Now whenever you can use latest ECMAScript features with babel-node or babel-cli.

Via CLI

babel source.js --presets node8
# or
babel ./src -d ./dist --presets node8

Via Node API

require('babel-core').transform('Your source code', {
  presets: ['node8'],
})

Also you can use babel-register to transpile in runtime:
require('babel-register')
require('./path/to/es6-7/sources')

Webpack, Rollup, Browserify, Gulp, etc.

Follow vendor instructions and include node8 preset in your babel "preset" list (if needed).

React support

Babel already has a preset for React, and you now need to install it separately.
npm install --save-dev babel-preset-react

And then add it to your "presets" list in .babelrc file:
{
  "presets": [
    "node8",
    "react"
  ]
}

Credits

Created by Sergey Sova (LestaD).