node.js - How to enable browserify transform only in one environment -
i have project layout this:
gulpfile.js node_modules/ foo/ bar/ where foo/ , bar/ modules own code want apply browserify transforms. (this hack avoid relative paths require("../../blah"), instead being able write require("foo/pkg/blah").)
because of way browserify works, need have package.json file within both foo/ , bar/ modules, contents that:
{ "browserify": { "transform": ["rewireify"] } } otherwise browserify apply transform root module, not on submodules.
but i'd apply rewireify transform when running tests (it's adding dependency injection code each module don't want include production build).
but disabling rewireify transform @ top level doesn't affect submodules.
is there way enable browserify transforms in environment? or maybe way enable package.json settings based on environment?
ps. i've found workaround hacking rewireify transform source, nice achieve wouldn't need fork transform.
Comments
Post a Comment