back to listing index

Babel · The compiler for writing next generation JavaScript

[web search]
Original source (babeljs.io)
Tags: javascript es6 babel ecmascript es2015 react
Clipped on: 2015-12-08

Babel is a JavaScript compiler.

Use next generation JavaScript, today.

Babel transforms your JavaScript

You put JavaScript in

myJavaScript("foobar");

And get JavaScript out

myNewTransformedJavaScript("yay!");

ES2015 and beyond

Babel has support for the latest version of JavaScript through syntax transformers. These allow you to use new syntax, right now without waiting for browser support. Check out our ES2015 preset to get started. Learn about ES2015 →

  • Arrow functions
  • Async functions
  • Async generator functions
  • Classes
  • Class properties
  • Computed property names
  • Constants
  • Decorators
  • Default parameters
  • Destructuring
  • Exponentiation operator
  • For-of
  • Function bind
  • Generators
  • Let scoping
  • Modules
  • Module export extensions
  • Object rest/spread
  • Property method assignment
  • Property name shorthand
  • Rest parameters
  • React
  • Spread
  • Template literals
  • Type annotations
  • Unicode regex

export default React.createClass({
  getInitialState() {
    return { num: this.getRandomNumber() };
  },

  getRandomNumber(): number {
    return Math.ceil(Math.random() * 6);
  },

  render(): any {
    return <div>
      Your dice roll:
      {this.state.num}
    </div>;
  }
});

JSX and React

Babel has support for JSX and Flow. Check out our React preset to get started. Use it together with the babel-sublime package to bring syntax highlighting to a whole new level.


Pluggable

Babel is built out of plugins. Compose your own transformation pipeline using existing plugins or write your own. Easily use a set of plugins by using or creating a preset. Learn more →

Image (Asset 1/19) alt=


Babel · v6.x · Distributed under MIT License

Looking for Babel 5.x docs? · Found an issue with the docs? Report it here.