Closed DrewML closed 9 years ago
So this is handled correctly in proxyquire (Node) but not here. It was fixed fairly recently over there. And proxyquireify actually handles a case proxyquire doesn't (prototypes):
I'm going to pull the correct implementation out to a module and fix it there.
@bendrucker You're fast! Thanks for identifying/submitting a PR for that so quickly. I really appreciate it.
So the issue I reported over at https://github.com/bendrucker/proxyquire-universal/issues/18 actually seems to be related to this issue. When I set a stub to false
, the stub is ignored, but, when I set the stub to a truthy value, the stub is used, even in the browser.
I am guessing this has to do with "simulating the absence of modules", but I was under the impression that setting a stub to null
meant that the stub was ignored, not simply a falsey value.
Note: I am using proxyquirify@3.0.1
.
You're totally right. The behavior is inconsistent w/ proxyquire. Will get a PR up now. This will most likely be a major bump since it's a bug fix in some sense but also a breaking change.
This is actually an entirely different issue though, let's move discussion over
Sure. Send the link.
To start with, thank you so much for the effort you've put into this module! It's exactly what I need for a current project.
I am running into one issue. In my project, I have a JSON file on disk that I
require
into modules. I'm attempting to useproxyquireify
to overwrite values in this config. This has worked great, except for the use-case where I want to overwrite a value tofalse
.Example:
With the stubs above, I get the following behavior:
featureName
is set to'test name'
as expectedflag1
is still true (should be false)I'm guessing that
proxyquireify
does a truthy check when looping over each stub in a file, to check if it actually exists.