This is a thin wrapper of browserify-middleware which lets you serve browserified files on the fly, quickly and setupless. There are other Babel-related middlewares but they all rely on gulp, watch, or similar approaches. I wanted to begin coding right away and worry about the build later.
npm install express-babelify-middleware
babelify(entries, [browserifyOptions], [babelifyOptions])
- entries: directory, file, or packages, see browserify-middleware examples
- browserifyOptions: see browserify-middleware options
- browserify default settings from
- babelifyOptions: see Babel options
import babelify from 'express-babelify-middleware' import express from 'express' var app = express() app.use('/app.js', babelify('public/app.js')) app.use(express.static('public'))
Depending your project structure, notice that you may need to put babelify before the static middleware.