BROWSERIFY(1)
π BROWSERIFY π
okay bestie, welcome to the browserify manual β section 1 of the manual, the "user commands" shelf, and honestly it's giving main character energy. this whole page is about browserify, the tool that browserifies your Node.js sources. let's get into it, no cap. β¨
π NAME π
browserify β browserify Node.js sources π¦
π SYNOPSIS π
browserify [entry files] {OPTIONS}
πΈ DESCRIPTION πΈ
okay so here's the literal tea, and it's kind of iconic: browsers do not have the require method defined. like, it's just not a thing over there. but Node.js does have it. π
and with Browserify you can write code that uses require in the exact same way that you would use it in Node. that's the whole vibe. that's the whole point. periodt. π
β¨ OPTIONS β¨
β Standard Options β
--outfile,-oβ write the browserify bundle to this file. if you don't specify one, browserify just prints tostdout. lowkey iconic default behavior π«--require,-rβ a module name or file tobundle.require(). optionally use a colon separator to set the target. π«Ά--entry,-eβ an entry point of your app. your lil doorway, your main character moment πͺβ¨--ignore,-iβ replace a file with an empty stub. files can be globs. bye bestie, you're an empty stub now π--exclude,-uβ omit a file from the output bundle. files can be globs. not invited to the party π--external,-xβ reference a file from another bundle. files can be globs. it lives somewhere else, we're just saying hi π--transform,-tβ use a transform module on top-level files.--command,-cβ use a transform command on top-level files.--standalone,-sβ generate a UMD bundle for the supplied export name. this bundle works with other module systems, and it sets the name you gave as a window global if no module system is found. versatile queen π--debug,-dβ enable source maps that let you debug your files separately. literally a lifesaver when everything is on fire π--help,-hβ show this message.
for advanced options, type browserify --help advanced.
specify a parameter.
π₯ Advanced Options π₯
--insert-globals,--ig,--fastβ [default:false] skip detection and always insert definitions forprocess,global,__filename, and__dirname.
benefit: faster builds. cost: extra bytes. speed demon behavior but she's thicc π
--insert-global-vars,--igvβ comma-separated list of global variables to detect and define.
default: __filename,__dirname,process,Buffer,global
--detect-globals,--dgβ [default:true] detect the presence ofprocess,global,__filename, and__dirnameand define these values when present.
benefit: npm modules more likely to work. cost: slower builds. slow and steady, but she WORKS π’β¨
--ignore-missing,--imβ [default:false] ignorerequire()statements that don't resolve to anything. let it go, let it gooo π§--noparse=FILEβ don't parseFILEat all. this will make bundling much, much faster for giant libs likejqueryorthreejs. the way that skipping the parse makes the build zoom?? obsessed π--no-builtinsβ turn off builtins. this is handy when you want to run a bundle in node, which provides the core builtins. π--no-commondirβ turn off setting a commondir. this is useful if you want to preserve the original paths that a bundle was generated with.--no-bundle-externalβ turn off bundling of all external modules. this is useful if you only want to bundle your local files. homegirl only, no strangers π--bareβ alias for both--no-builtins,--no-commondir, and sets--insert-global-varsto just"__filename,__dirname". this is handy if you want to run bundles in node. the minimalist icon π--no-browser-field,--no-bfβ turn offpackage.jsonbrowser field resolution. this is also handy if you need to run a bundle in node.--transform-keyβ instead of the defaultpackage.json#browserify#transformfield to list all transforms to apply when running browserify, a custom field, like, e.g.package.json#browserify#productionorpackage.json#browserify#stagingcan be used, by for example running:browserify index.js --transform-key=production > bundle.jsbrowserify index.js --transform-key=staging > bundle.js
pick your era, pick your field π
--nodeβ alias for--bareand--no-browser-field.--full-pathsβ turn off converting module ids into numerical indexes. this is useful for preserving the original paths that a bundle was generated with.--depsβ instead of standard bundle output, print the dependency array generated bymodule-deps. it's giving receipts π§Ύ--no-dedupeβ turn off deduping. no more copy-paste merging, everyone stands on their own πͺ--listβ print each file in the dependency graph. useful for makefiles. a lil roster of everyone invited π--extension=EXTENSIONβ consider files with the specifiedEXTENSIONas modules. this option can be used multiple times. stack 'em, queen π₯--global-transform=MODULE,-g MODULEβ use a transform module on all files after any ordinary transforms have run. everybody gets a glow-up β¨--plugin=MODULE,-p MODULEβ registerMODULEas a plugin. π¦--preserve-symlinksβ preserves symlinks when resolving modules. π
π Passing arguments to transforms and plugins π
for -t, -g, and -p, you may use subarg syntax to pass options to the transforms or plugin function as the second parameter. for example:
-t [ foo -x 3 --beep ]
will call the foo transform for each applicable file by calling:
foo(file, { x: 3, beep: true })
so cute, so powerful, iykyk π₯
π SEE ALSO π
and that's the whole page bestie!! π«Ά this was browserify version 17.0.0, dated September 2021, and the manual page itself is the BROWSERIFY(1) page β go forth and bundle, you absolute legend πβ¨πΈ
π¦ where this page comes from
- debian bookworm: node-browserify 17.0.0+ds-5 Β· MIT
- debian trixie: node-browserify 17.0.0+ds-5 Β· MIT
- ubuntu jammy: node-browserify 17.0.0+ds-3 Β· MIT
- ubuntu noble: node-browserify 17.0.0+ds-5 Β· MIT
- ubuntu questing: node-browserify 17.0.0+ds-5
- ubuntu resolute: node-browserify 17.0.1+ds-1build1 Β· MIT
- ubuntu stonking: node-browserify 17.0.1+ds-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms