{"id":19375,"library":"babelify","title":"babelify","description":"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.","status":"active","version":"10.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babelify","tags":["javascript"],"install":[{"cmd":"npm install babelify","lang":"bash","label":"npm"},{"cmd":"yarn add babelify","lang":"bash","label":"yarn"},{"cmd":"pnpm add babelify","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; Babel 7 core library required at runtime","package":"@babel/core","optional":false}],"imports":[{"note":"ESM import works; CommonJS require also OK, but ESM is modern.","wrong":"const babelify = require('babelify')","symbol":"babelify (default)","correct":"import babelify from 'babelify'"},{"note":"configure is a named export; CommonJS pattern works but named import is cleaner.","wrong":"const configure = require('babelify').configure","symbol":"babelify.configure","correct":"import { configure } from 'babelify'"},{"note":"Can pass package name string or the require'd transform function.","wrong":"browserify().transform(babelify, { presets: [...] }) // also correct, but string form is more common","symbol":"transform usage","correct":"browserify().transform('babelify', { presets: ['@babel/preset-env'] })"}],"quickstart":{"code":"import browserify from 'browserify';\nimport fs from 'fs';\nimport babelify from 'babelify';\n\nconst b = browserify('./src/index.js');\nb.transform(babelify.configure({\n  presets: ['@babel/preset-env', '@babel/preset-react'],\n  extensions: ['.js', '.jsx']\n}));\nb.bundle()\n  .pipe(fs.createWriteStream('./dist/bundle.js'));","lang":"javascript","description":"Shows how to set up babelify with browserify, using configure() and specifying presets for ES6+ and React JSX."},"warnings":[{"fix":"Install @babel/core instead of babel-core. Update presets/plugins to @babel/* scope.","message":"babelify v10 requires @babel/core (Babel 7) as a peer dependency; v8 used babel-core (Babel 6).","severity":"breaking","affected_versions":">=10.0.0"},{"fix":"Install presets like @babel/preset-env and specify them in options.","message":"In Babel 6 and later, no plugins are included by default. You must install and configure presets/plugins explicitly.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade babelify to v10 and switch to @babel/core.","message":"babelify v8 (Babel 6) is no longer maintained; upgrade to v10 with Babel 7.","severity":"deprecated","affected_versions":">=8.0.0 <10.0.0"},{"fix":"Prefer using the string name 'babelify' in transform() to avoid context issues.","message":"If 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.","severity":"gotcha","affected_versions":"*"},{"fix":"Pass a RegExp object, e.g., /node_modules/.","message":"The `ignore` option is a regex that when matched skips compilation; common mistake: using a string instead of RegExp.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev @babel/core'","cause":"@babel/core is a required peer dependency not installed.","error":"Error: Cannot find module '@babel/core'"},{"fix":"Install @babel/core v7 and remove babel-core.","cause":"babelify v10 requires Babel 7, but an older babel-core is installed.","error":"Error: Requires Babel \"^7.0.0-0\", but was loaded with \"6.x.x\""},{"fix":"Add presets like @babel/preset-env and @babel/preset-react to babelify options.","cause":"Babel 6+ requires presets to transform modern JS/JSX; none provided.","error":"SyntaxError: Unexpected token import (or JSX) - no presets configured"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}