I have some code which is structured something like the following which I'd like to transform with browserify + brfs.
var fs = require('fs');
var foo = function(fs) {
if (fs) {
// Do something
}
}
foo(fs);
The main reason this doesn't work[1] at the moment is the fact that the var fs = require('fs'); line is removed during the transform leading to a ReferenceError: fs is not defined when calling foo.
I'm not concerned with making methods called on fs within foo do the right thing, I'd be happy if after this was transformed fs was undefined within foo.
With that in mind, would you be open to merging a PR which preserves the declaration of fs when transforming the above, perhaps leaving behind just var fs;, or do you see that as been at odds with the basic approach that static-module takes?
[1] There are a couple of other reasons why this doesn't work, but they seem more straight-forward to address.
I have some code which is structured something like the following which I'd like to transform with browserify + brfs.
The main reason this doesn't work[1] at the moment is the fact that the
var fs = require('fs');
line is removed during the transform leading to aReferenceError: fs is not defined
when callingfoo
.I'm not concerned with making methods called on
fs
withinfoo
do the right thing, I'd be happy if after this was transformedfs
wasundefined
withinfoo
.With that in mind, would you be open to merging a PR which preserves the declaration of
fs
when transforming the above, perhaps leaving behind justvar fs;
, or do you see that as been at odds with the basic approach thatstatic-module
takes?[1] There are a couple of other reasons why this doesn't work, but they seem more straight-forward to address.