-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require-in-the-middle does not work when using request-promise & request-promise-native #61
Comments
One option to solve this: instead of returning the cached entry, you could return the original export if the export has changed. You just need to move this line above the cache check and compare the export results.
As the implementation of Node.js You would then check if the export have changed, if yes - return the original export. |
@trentm I've suggested a solution to the bug report. I can create a bug fix PR if you are okay with it. Thanks |
…odules This allows a user to delete from `require.cache` to trigger a re-load of a module (and a re-run of the hook's `onrequire`) on next `require()`. This also removes the `.cache` field from the Hook object. It was never documented, but it wasn't prefixed with `_` to hint at being private. As well, some tests used it, which might have given the impression it could be used externally. I'm calling this a semver-major change to give a heads up to users that might have been using it. Fixes: #61
@kirrg001 Sorry for the delay. I've created a PR that fixes this -- at least for the cases that I see, including your "reproduce.zip". Thanks very much for that. |
…odules (#63) This allows a user to delete from `require.cache` to trigger a re-load of a module (and a re-run of the hook's `onrequire`) on next `require()`. This also removes the `.cache` field from the Hook object. It was never documented, but it wasn't prefixed with `_` to hint at being private. As well, some tests used it, which might have given the impression it could be used externally. I'm calling this a semver-major change to give a heads up to users that might have been using it. Fixes: #61 Obsoletes: #57
Hi there!
I am running into an error when requiring
request-promise
&request-promise-native
.The
request
module is used byrequest-promise
andrequest-promise-native
. Butrequire-in-the-middle
returns a patched copy ofrequest
, which makes it impossible to requirerequest-promise-native
.See https://github.com/request/request-promise-native/blob/master/lib/rp.js#L7
See https://github.com/request/request-promise/blob/master/lib/rp.js#L10
Although
request
is deprecated, I think this is a general problem withrequire-in-the-middle
when using two libraries, which need a fresh copy of a module.I have attached a zip, which reproduces the error.
Regards,
Kate
reproduce.zip
The text was updated successfully, but these errors were encountered: