Express/Connect middleware to pre-process requested JS files through Babel
npm install babel-middlewarebabel-middleware
================
Simple Express/Connect middleware to automatically transpile JavaScript files
from ES2015+ to ES5 via Babel, and cache the results to memory or the
file-system as desired.
Usage
=====
``javascript
`
var express = require('express');
var babel = require('babel-middleware');
var app = express();
app.use('/js/', babel({
srcPath: 'app/js',
cachePath: __dirname + '/_cache'
babelOptions: {
presets: ['es2015']
}
}));
app.listen(3001);
srcPath
Options
=======
$3
An absolute or relative path to the input source. This option is required.
$3
Use either _memory_ for an in-memory cache; or a path to the desired cache directory (it does not need to exist when the app starts).
Default: _memory_
$3
An array of path globs to exclude from transpiling and caching. Returns the originally requested file. See Micromatch documentation for globbing examples. Exclusions do not match against .
babel.transformFile`. See Babel documentation for usage.
Default: _[]_
$3
An options object passed into