BROWSER-INSERT-MODULE-GLOBALS(1)

πŸ’– browser-insert-module-global(1) β€” the manual, but make it cute

okay bestie, welcome to the browser-insert-module-global page from the <rainbow>browserify</rainbow> corner of the manual. this one is a lil tool, not a whole vibe, but she's important. let's go πŸ’…


✨ NAME ✨

browser-insert-module-global β€” browserify tools to insert global module list 🫢


✨ SYNOPSIS ✨

browser-insert-module-global [file]

✨ DESCRIPTION ✨

so, what does she actually do? browser-insert-module-global packs node-style source files' dependencies. that's the whole job, and she does it with main character energy. πŸ‘‘

here's the tea, fr fr: browser-insert-module-global takes a javascript file as input, and gives you back a transformed javascript file β€” with a closure wrapped around the contents whenever that's necessary, so that extra builtins can be defined. cute, right? πŸŽ€

and by default? she reads from STDIN. no arguments needed, she'll just vibe with whatever you pipe in. πŸ¦‹


✨ EXAMPLES ✨

here's the iconic pipeline, copy it exactly bestie, no cap:

browser-module-deps /usr/share/doc/node-insert-module-globals/examples/main.js | browser-insert-module-globals | browser-pack | node

and the output from that run, verbatim:

in main.js: {"__filename":"/main.js","__dirname":"/"}
in foo/index.js: {"__filename":"/foo/index.js","__dirname":"/foo"}

like… look at that. __filename and __dirname getting their little moments. obsessed. ✨

heads up: the example calls browser-insert-module-globals with an s on the end, and the page you're reading is browser-insert-module-global without one. that's just how the original is written, so i'm keeping it exactly as-is β€” i don't make the rules, i just write them down πŸ’€

✨ SEE ALSO ✨

go read those too, bestie, they're the rest of the friend group 🌈


that's the whole page!! she's from 8/4/17, source line says browser-insert-module-global(1), and that's the version + date sign-off. bye babe, go pipe something into stdin πŸ’œ