browserify
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
JSONStream | 1.3.5 | 136.16 kB | (MIT OR Apache-2.0) | prod | |
assert | 1.5.1 | 10.41 kB | MIT | prod | |
browser-pack | 6.1.0 | 7.91 kB | MIT | prod | |
browser-resolve | 2.0.0 | 5.01 kB | MIT | prod | |
browserify-zlib | 0.2.0 | 46.93 kB | MIT | prod | |
buffer | 5.2.1 | 19.98 kB | MIT | prod | |
cached-path-relative | 1.1.0 | 1.94 kB | MIT | prod | |
concat-stream | 1.6.2 | 3.72 kB | MIT | prod | |
console-browserify | 1.2.0 | 4.13 kB | MIT | prod | |
constants-browserify | 1.0.0 | 3.3 kB | MIT | prod | |
crypto-browserify | 3.12.0 | 15.07 kB | MIT | prod | |
defined | 1.0.1 | 4.54 kB | MIT | prod | |
deps-sort | 2.0.1 | 4.5 kB | MIT | prod | |
domain-browser | 1.2.0 | 4.73 kB | MIT | prod | |
duplexer2 | 0.1.4 | 2.75 kB | BSD-3-Clause | prod | |
events | 3.3.0 | 16.19 kB | MIT | prod | |
glob | 7.2.3 | 15.08 kB | ISC | prod | |
has | 1.0.4 | 1.59 kB | MIT | prod | |
htmlescape | 1.1.1 | 2.55 kB | MIT | prod | |
https-browserify | 1.0.0 | 1.55 kB | MIT | prod | |
inherits | 2.0.4 | 1.98 kB | ISC | prod | |
insert-module-globals | 7.2.1 | 9.51 kB | MIT | prod | |
labeled-stream-splicer | 2.0.2 | 3.69 kB | MIT | prod | |
mkdirp-classic | 0.5.3 | 1.91 kB | MIT | prod | |
module-deps | 6.2.3 | 20.86 kB | MIT | prod | |
os-browserify | 0.3.0 | 1.56 kB | MIT | prod | |
parents | 1.0.1 | 2.67 kB | MIT | prod | |
path-browserify | 1.0.1 | 12.18 kB | MIT | prod | |
process | 0.11.10 | 4.56 kB | MIT | prod | |
punycode | 1.4.1 | 7.87 kB | MIT | prod | |
querystring-es3 | 0.2.1 | 6.06 kB | MIT | prod | |
read-only-stream | 2.0.0 | 2.43 kB | MIT | prod | |
readable-stream | 2.3.8 | 25.14 kB | MIT | prod | |
resolve | 1.22.8 | 26.69 kB | MIT | prod | |
shasum-object | 1.0.0 | 3.84 kB | Apache-2.0 | prod | |
shell-quote | 1.8.1 | 15.23 kB | MIT | prod | |
stream-browserify | 3.0.0 | 4.46 kB | MIT | prod | |
stream-http | 3.2.0 | 9.44 kB | MIT | prod | |
string_decoder | 1.3.0 | 4.51 kB | MIT | prod | |
subarg | 1.0.0 | 2.52 kB | MIT | prod | |
syntax-error | 1.4.0 | 3.7 kB | MIT | prod | |
through2 | 2.0.5 | 3.96 kB | MIT | prod | |
timers-browserify | 1.4.2 | 7.05 kB | MIT | prod | |
tty-browserify | 0.0.1 | 1.22 kB | MIT | prod | |
url | 0.11.3 | 17.75 kB | MIT | prod | |
util | 0.12.5 | 9.75 kB | MIT | prod | |
vm-browserify | 1.1.2 | 4.82 kB | MIT | prod | |
xtend | 4.0.2 | 2.47 kB | MIT | prod |
Browserify is a JavaScript tool that allows you to use the Node.js require()
function in your code that runs in the browser. It does this by bundling up all of your dependencies into a single JavaScript file, which can then be included in a web page using a single <script>
tag. This helps you manage and organize your browser JavaScript code in a modern way, similar to how you would on a Node.js server side application. Browserify also brings the power of NPM to the browser letting you leverage its vast ecosystem.
Browserify is easy to use once it is installed. It can be installed globally using NPM (Node Package Manager):
npm install -g browserify
To use it, you just need to create a JavaScript file (let's name it main.js
) with some require()
calls in it:
var foo = require('./foo.js');
var bar = require('../lib/bar.js');
var gamma = require('gamma');
var elem = document.getElementById('result');
var x = foo(100) + bar('baz');
elem.textContent = gamma(x);
Then you can create a browserified bundle of your main.js
and all its dependencies by running a command in your terminal:
browserify main.js > bundle.js
The bundle.js
file that is created by the above command will contain your main.js
file and all the modules it requires. It can then be included in your HTML file:
<script src="bundle.js"></script>
Browserify can also be used programmatically via its API in case you need more control over the bundling process. For example:
var browserify = require('browserify');
var fs = require('fs');
var b = browserify();
b.add('./browser/main.js');
b.bundle().pipe(fs.createWriteStream('bundle.js'));
The official documentation for Browserify can be found in several places. The first place is the Browserify GitHub repository, which includes the README file that provides an overview of how to use Browserify. In addition, the Browserify Handbook on GitHub provides a more detailed guide on Browserify's capabilities, usage, and ecosystem. The Browserify website is also a good resource for tutorials and examples.