Skip to content
Gilbert edited this page Jun 22, 2016 · 5 revisions

To add ES6 / Babel support for your browser JavaScript, first install babelify:

$ npm install babelify babel-preset-es2015 --save

then, modify your server/index.js to include babelify as a transformation:

var browserify = require('browserify-middleware')
var babelify = require("babelify")

app.get('/js/app-bundle.js',
  browserify('./client/app.js', {
    transform: [babelify, { presets: ['es2015'] }]
  }))

To use any additional babel transforms, npm install them, add the preset name to the presets array, and restart your server.

Clone this wiki locally