fly-babel
raw JSON → 2.1.1 verified Sat Apr 25 auth: no javascript maintenance
Babel plugin for the Fly build system, version 2.1.1. It allows you to transpile ES6/ES2015+ code using Babel within Fly pipelines. The plugin supports standard Babel options (presets, plugins, sourceMaps, etc.) and a preload feature that automatically loads Babel plugins/presets from package.json. Release cadence is low; last release was in 2018. Key differentiator: tight integration with Fly, including preloading and simple generator-based task syntax. Requires Node >= 4.6 and Fly 2.0+.
Common errors
error TypeError: fly.source(...).babel is not a function ↓
cause fly-babel plugin not installed or not registered with Fly.
fix
Run
npm install --save-dev fly-babel and ensure Fly is configured to load the plugin (e.g., via 'fly clear' or plugin registration). error Error: Couldn't find preset 'es2015' relative to directory ↓
cause Required Babel preset not installed.
fix
Install the preset:
npm install --save-dev @babel/preset-env (or babel-preset-es2015 for older Babel). error ReferenceError: regeneratorRuntime is not defined ↓
cause Using ES6 generators (async/await) without proper Babel runtime polyfill.
fix
Install and configure 'babel-plugin-transform-runtime' or include 'babel-polyfill' in your code.
Warnings
breaking Version 2.1.0 dropped Node 4.x support; requires Node >= 6.x. ↓
fix Upgrade Node to >=6.x, or use fly-babel@0.2.1 for Node 4.x support.
deprecated This plugin is for the legacy Fly build system (flyjs). Fly is no longer maintained. ↓
fix Consider migrating to modern build tools like Webpack, Rollup, or esbuild.
gotcha The .babel() method must be called inside a generator function (function *). Using async/await or regular functions will fail. ↓
fix Use 'function * (fly) { ... }' syntax. Promises are not supported.
gotcha preload: true only works if babel plugins/presets are listed in package.json under 'devDependencies' or 'dependencies' and named conventionally (e.g., 'babel-preset-*' or 'babel-plugin-*'). ↓
fix Ensure packages are installed and named properly. For custom names, configure presets/plugins manually.
gotcha Source maps may not work correctly if the source is processed by multiple plugins (e.g., fly-clear or fly-concat). ↓
fix Test source map output; consider using 'inline' or 'both' for simpler debugging.
Install
npm install fly-babel yarn add fly-babel pnpm add fly-babel Imports
- fly-babel plugin wrong
import flyBabel from 'fly-babel';correctconst flyBabel = require('fly-babel'); // used internally by Fly, no direct import in user code - .babel() wrong
fly.source('src/**/*.js').babel().target();correctyield fly.source('src/**/*.js').babel({ presets: ['es2015'] }).target('dist/'); - options.preload wrong
yield fly.source('src/**/*.js').babel({ preload: false });correctyield fly.source('src/**/*.js').babel({ preload: true }).target('dist/');
Quickstart
// In your flyfile.js
const fly = require('fly');
export default function* (fly) {
yield fly.source('src/**/*.js')
.babel({
presets: ['@babel/preset-env'],
sourceMaps: 'inline'
})
.target('dist/');
}