Coder Social home page Coder Social logo

babel-preset-nodejs6's Introduction

Babel 6.x presets for Node 6.x

Node 6.x comes with V8 v5.x which brings ~93% native ES6/ES2015 coverage. This preset for Babel 6 attempts to bridge the gap for the much of the remaining ~7% using Babel plug-ins.

Based on Node.js v6.0.0

Why

Babel 6.x is awesome, but simply including the ES2015 preset means you're transpiling features that your Node 6.x installation can already do faster and natively, replacing them with inferior / older code.

This preset complements existing V8-native functionality - it doesn't work around it.

The end result is nearly always a faster build and script execution time.

Included Plugins:

  • babel-plugin-transform-es2015-modules-commonjs
  • babel-plugin-transform-async-to-generator
  • babel-plugin-transform-class-properties
  • babel-plugin-transform-es2015-parameters
  • babel-plugin-transform-object-rest-spread

Installation

Install via NPM the usual way:

npm i babel-preset-nodejs6

Usage

Via .babelrc (recommended)

Create a .babelrc file in your project root, and include 'nodejs6' in your preset path:

{
  "presets": [
    "nodejs6"
  ]
}

Now whenever you run babel-node, it will polyfill your app with the remaining ES2015 features that Node 6 is missing.

Via CLI

$ babel script.js --presets nodejs6

How to add React support

Babel has a ready-made preset for React, and you now need to install it separately.

Just grab it via NPM:

npm i babel-preset-react

And then add it to your "presets" list in .babelrc:

{
  "presets": [
    "nodejs6",
    "react"
  ]
}

Credits

Forked and updated from @leebenson's node5 preset.

babel-preset-nodejs6's People

Contributors

aredridel avatar josmardias avatar leebenson avatar ljharb avatar salakar avatar sapegin avatar weijarz avatar

Watchers

 avatar  avatar

Forkers

aredridel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.