Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
babelify
Advanced tools
Readme
Babel browserify plugin
$ npm install --save-dev babelify
$ browserify script.js -t babelify --outfile bundle.js
var fs = require("fs");
var browserify = require("browserify");
var babelify = require("babelify");
browserify({ debug: true })
.transform(babelify)
.require("./script.js", { entry: true })
.bundle()
.on("error", function (err) { console.log("Error : " + err.message); })
.pipe(fs.createWriteStream("bundle.js"));
browserify().transform(babelify.configure({
blacklist: ["generators"]
}))
$ browserify -d -e script.js -t [ babelify --blacklist generators ]
By default 6to5's experimental transforms
are disabled. You can turn them on by passing experimental
as a configuration option.
browserify().transform(babelify.configure({
experimental: true
}))
$ browserify -d -e script.js -t [ babelify --experimental ]
By default all files with the extensions .js
, .es
, '.es6
and .jsx
are compiled.
You can change this by passing an array of extensions.
NOTE: This will override the default ones so if you want to use any of them you have to add them back.
browserify().transform(babelify.configure({
extensions: [".6to5"]
}))
$ browserify -d -e script.js -t [ babelify --extensions .6to5 ]
Browserify passes an absolute path so there's no way to determine what folder
it's relative to. You can pass a relative path that'll be removed from the
absolute path with the sourceMapRelative
option.
browserify().transform(babelify.configure({
sourceMapRelative: "/Users/sebastian/Projects/my-cool-website/assets"
}))
$ browserify -d -e script.js -t [ babelify --sourceMapRelative . ]
browserify().transform(babelify.configure({
// Optional ignore regex - if any filenames **do** match this regex then they
// aren't compiled
ignore: /regex/,
// Optional only regex - if any filenames **don't** match this regex then they
// aren't compiled
only: /my_es6_folder/
}))
$ browserify -d -e script.js -t [ babelify --ignore regex --only my_es6_folder ]
As a convenience, the babelify polyfill is exposed in babelify. If you've got a browserify-only package this may alleviate the necessity to have both babel & babelify installed.
// In browser code
require("babelify/polyfill");
FAQs
Babel browserify transform
The npm package babelify receives a total of 542,242 weekly downloads. As such, babelify popularity was classified as popular.
We found that babelify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.