Socket
Socket
Sign inDemoInstall

babelify

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babelify

Babel browserify transform


Version published
Weekly downloads
687K
increased by0.56%
Maintainers
2
Weekly downloads
 
Created

What is babelify?

Babelify is a browserify transform for Babel, which allows you to use Babel to transpile your JavaScript files when bundling them with Browserify. This enables you to use the latest JavaScript features and syntax in your code, and have them transpiled to a version of JavaScript that is compatible with older browsers.

What are babelify's main functionalities?

Transpile ES6 to ES5

This feature allows you to transpile modern JavaScript (ES6) to ES5, making it compatible with older browsers. The code sample demonstrates how to use Babelify with Browserify to transform a source file using the '@babel/preset-env' preset.

const browserify = require('browserify');
const babelify = require('babelify');

browserify('./src/app.js')
  .transform(babelify, { presets: ['@babel/preset-env'] })
  .bundle()
  .pipe(process.stdout);

Use JSX with React

This feature allows you to use JSX syntax with React. The code sample shows how to configure Babelify to transform a JSX file using the '@babel/preset-react' preset.

const browserify = require('browserify');
const babelify = require('babelify');

browserify('./src/app.jsx')
  .transform(babelify, { presets: ['@babel/preset-react'] })
  .bundle()
  .pipe(process.stdout);

Custom Babel Plugins

This feature allows you to use custom Babel plugins. The code sample demonstrates how to use the '@babel/plugin-transform-arrow-functions' plugin to transform arrow functions in your code.

const browserify = require('browserify');
const babelify = require('babelify');

browserify('./src/app.js')
  .transform(babelify, { plugins: ['@babel/plugin-transform-arrow-functions'] })
  .bundle()
  .pipe(process.stdout);

Other packages similar to babelify

FAQs

Package last updated on 11 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc