0.2.2 • Published 9 years ago
browserify-swap v0.2.2
browserify-swap
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.
package.json
{
"browserify": {
"transform": [ "browserify-swap" ]
},
"browserify-swap": {
"@packages": [ "hyperwatch" ],
"dev": {
".*node_modules\/hyperwatch\/\\S+\\.js$": "./swap/some-hyperwatch-swap.js",
"util.js$": "myutil"
},
"test": {
"util.js$": "test-util"
}
}
}
- each file matcher (i.e.
'util.js$'
) is a regular expression - in order to swap files of dependencies the
browserify-swap
transform needs to be injected into its package, therefore indicate those packages via the@packages
array
BROWSERIFYSWAP_ENV='dev' browserify . -o bundle.js
Installation
npm install browserify-swap
API
generated with docme
License
MIT