Browserify walks require() calls in your JavaScript and packs dependencies into one browser file. It supports npm modules, shims for Node core libs, and a CLI plus programmatic API.
Overview
Browserify lets front-end code use the same require() style as Node by recursively analyzing the dependency graph from entry files and emitting a single bundle for script tags. Many npm packages without Node-only I/O work after bundling; Node built-ins are available only when explicitly required through browser-specific shims.
The CLI accepts entry paths and options for debug source maps, external bundles, standalone UMD builds, and transforms such as CoffeeScript or coffeeify. The API exposes add, require, bundle, external, ignore, exclude, transform, and plugin hooks, plus a labeled internal pipeline you can extend.
package.json browser fields remap files for client builds. Patterns like multiple bundles with shared vendor chunks use external and require flags to cache common modules across pages. Plugins and handbook guides cover partitioning and advanced workflows; companion tools such as watchify, tinyify, and beefy are commonly used around Browserify in development.
Global variables process, __dirname, __filename, and global are defined in output when detected or when insertGlobals is enabled, improving compatibility with npm code in the browser.
Key features
- Recursive require() dependency graph
- npm module resolution in bundles
- Node core library shims
- CLI and JavaScript API
- Inline or external source maps
- Transform pipeline for compilers
- package.json browser field support
- Standalone UMD bundle option
Use cases
- Bundling legacy CommonJS front ends
- Using npm libraries in static sites
- Splitting shared vendor bundles
- Shipping browser builds with Node idioms
- Prototyping before newer bundlers