Registry / devops / babelify

babelify

JSON →
library10.0.0jsnpmunverified

Babel browserify transform that compiles JavaScript files using Babel during browserify bundling. Current stable version is 10.0.0, released on an as-needed basis. Supports Babel 7 with @babel/core as a peer dependency. Differentiates from other Babel integrations by tight coupling with browserify's transform pipeline, allowing per-file compilation with source maps and custom file extensions. Requires user-supplied presets/plugins for any transformation since Babel 6.

npm install babelify
INSTALL
IMPORT
SIG · BABELIFY
B
babelify
devopsjavascriptv10.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

babelify (default)
import babelify from 'babelify'
const babelify = require('babelify')
ESM import works; CommonJS require also OK, but ESM is modern.
babelify.configure
import { configure } from 'babelify'
const configure = require('babelify').configure
configure is a named export; CommonJS pattern works but named import is cleaner.
transform usage
browserify().transform('babelify', { presets: ['@babel/preset-env'] })
browserify().transform(babelify, { presets: [...] }) // also correct, but string form is more common
Can pass package name string or the require'd transform function.

Shows how to set up babelify with browserify, using configure() and specifying presets for ES6+ and React JSX.

import browserify from 'browserify'; import fs from 'fs'; import babelify from 'babelify'; const b = browserify('./src/index.js'); b.transform(babelify.configure({ presets: ['@babel/preset-env', '@babel/preset-react'], extensions: ['.js', '.jsx'] })); b.bundle() .pipe(fs.createWriteStream('./dist/bundle.js'));
Debug
Known issues
breakingbabelify v10 requires @babel/core (Babel 7) as a peer dependency; v8 used babel-core (Babel 6).
fix
Install @babel/core instead of babel-core. Update presets/plugins to @babel/* scope.
affects: >=10.0.0
breakingIn Babel 6 and later, no plugins are included by default. You must install and configure presets/plugins explicitly.
fix
Install presets like @babel/preset-env and specify them in options.
affects: >=6.0.0
deprecatedbabelify v8 (Babel 6) is no longer maintained; upgrade to v10 with Babel 7.
fix
Upgrade babelify to v10 and switch to @babel/core.
affects: >=8.0.0 <10.0.0
gotchaIf you pass the babelify transform as a function (configure) rather than string, you must ensure it's required correctly. Using bind or .call may cause issues.
fix
Prefer using the string name 'babelify' in transform() to avoid context issues.
affects: *
gotchaThe `ignore` option is a regex that when matched skips compilation; common mistake: using a string instead of RegExp.
fix
Pass a RegExp object, e.g., /node_modules/.
affects: *
Errors
Common errors & fixes
Error: Cannot find module '@babel/core'
@babel/core is a required peer dependency not installed.
fix
Run 'npm install --save-dev @babel/core'
Error: Requires Babel "^7.0.0-0", but was loaded with "6.x.x"
babelify v10 requires Babel 7, but an older babel-core is installed.
fix
Install @babel/core v7 and remove babel-core.
SyntaxError: Unexpected token import (or JSX) - no presets configured
Babel 6+ requires presets to transform modern JS/JSX; none provided.
fix
Add presets like @babel/preset-env and @babel/preset-react to babelify options.
Upgrade
Version history
10.0.0latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency; Babel 7 core library required at runtime
Agent activity
2 hits · last 30 days
node
2
Resources
babelify — npm install babelify · libregistry