Code Monkey home page Code Monkey logo

ember-cli-babel's Introduction

ember-cli-babel

Build Status Build status

This Ember-CLI plugin uses Babel to allow you to use ES6 syntax with your Ember-CLI project.

Installation

npm install --save-dev ember-cli-babel

Usage

This plugin should work without any configuration after installing. By default it will take every .js file in your project and run it through the Babel transpiler to convert the ES6 code to ES5. Running existing ES5 code through the transpiler shouldn't change the code at all (likely just a format change if it does).

If you need to customize the way that Babel transforms your code, you can do it by passing in any of the options found here. Example:

// ember-cli-build.js

var app = new EmberApp({
  babel: {
    // disable comments
    comments: false,
    // don't transpile arrow and generator functions
    blacklist: [
      'es6.arrowFunctions',
      'regenerator'
    ]
  }
});

Polyfill

Babel comes with a polyfill that includes a custom regenerator runtime and core.js. Many transformations will work without it, but for full support you must include the polyfill in your app. The Babel feature tour includes a note for features that require the polyfill to work.

To include it in your app, pass includePolyfill: true in your ember-cli-babel options.

Features

Out of the box without a polyfill the following ES6 features are enabled:

Feature Supported
Arrows and Lexical This YES
Classes YES
Enhanced Object Literals YES
Template Strings YES
Destructuring YES
Default + Rest + Spread YES
Let + Const YES
Iterators + For..Of NO
Generators NO
Comprehensions YES
Unicode YES
Modules YES
Module Loaders NO
Map + Set + WeakMap + WeakSet NO
Proxies NO
Symbols NO
Subclassable Built-ins PARTIAL
Math + Number + String + Object APIs NO
Binary and Octal Literals PARTIAL
Promises NO
Reflect API NO
Tail Calls PARTIAL

See the Babel docs for more details

About Modules

Ember-CLI uses its own ES6 module transpiler for the custom Ember resolver that it uses. Because of that, this plugin disables Babel module compilation by blacklisting that transform. If you find that you want to use the Babel module transform instead of the Ember-CLI one, you'll have to explicitly set compileModules to true in your configuration. If compileModules is anything other than true, this plugin will leave the module syntax compilation up to Ember-CLI.

ember-cli-babel's People

Contributors

stefanpenner avatar rwjblue avatar turbo87 avatar gordonkristan avatar greenkeeperio-bot avatar sandersky avatar dfreeman avatar twokul avatar cibernox avatar chadhietala avatar hhff avatar jschiq2 avatar vitch avatar marpo60 avatar patocallaghan avatar sergiolepore avatar djchie avatar hsdwayne avatar

Watchers

James Cloos avatar

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.