v6.6.4_5Published 8 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.


For more info, please see

Original package info

Babel is a parser and transpiler for ECMAScript 2015 syntax and beyond, which enables some upcoming JavaScript syntax features to be used in today's browsers and runtimes.

Meteor's Babel support consists of the following core packages:

  • babel-compiler - Exposes the Babel API on the symbol Babel. For example, Babel.compile(source, options).

  • babel-runtime - Meteor versions of the external helpers used by Babel-generated code. Meteor's core packages must run on IE 8 without polyfills, so these helpers cannot assume the existence of Object.defineProperty, Object.freeze, and so on.

Babel API

The babel-compiler package exports the Babel symbol, which exposes functionality provided by the meteor-babel NPM package, which is in turn implmented using the babel-core NPM package. Note that you can only use the babel-compiler package on the server.


1var babelOptions = Babel.getDefaultOptions();
3// Modify the default options, if necessary:
4babelOptions.whitelist = [
5  "es6.blockScoping", // For `let`
6  "es6.arrowFunctions" // For `=>`
9var result = Babel.compile(
10  "let square = (x) => x*x;",
11  babelOptions
14// result.code will be something like
15// "var square = function (x) {\n  return x * x;\n};"

Use Babel.compile(source) to transpile code using a set of default options that work well for Meteor code.