swap/swäp/ - an act of exchanging one thing for another
A transform that swaps out modules according to a config in your
package.json selected via an environment variable.
'util.js$') is a regular expression
browserify-swaptransform needs to be injected into its package, therefore indicate those packages via the
BROWSERIFYSWAP_ENV='dev' browserify . -o bundle.js
npm install browserify-swap
Looks up browserify_swap configuratios specified for the given file in the environment specified via
If found the file content is replaced with a require statement to the file to swap in for the original. Otherwise the file's content is just piped through.
full path to file being transformed
transform stream into which
browserify will pipe the original content of the file
generated with docme