mercredi 8 mars 2017

Conditionally disable transforms in browserify

Today the I have setup NPM to run this command as the build script:

browserify browser-export.js -o dist/bundle.js -t [ babelify --presets [ es2015 ] ]

It uses this shim config in package.json:

"browserify": {
    "transform": ["browserify-shim"]
},
"browserify-shim": "../global-shims/config"

Now I'd like to run some tests on this code, but when browserifying the tests the needed globals are of course shimmed away ... This means that when running the tests through Browserify I need to disable the shimming. Is there any easy way of accomplishing this?

Aucun commentaire:

Enregistrer un commentaire