elastic/require-in-the-middle

Only the latest hook will get triggered

kjin opened this issue ยท 4 comments

kjin commented

I think this line is causing a second hook to override a first:

var exports = orig.apply(this, arguments)

Ah yes, I think you're spot on. This is because Module.prototype.require isn't overwritten in the same tick as when we're caching the original function.

If we just moved that into hook function then I think it would all work as expected ๐Ÿ˜ƒ

This have now been fixed in v3.0.0

kjin commented

Thanks!

This have now been released in elastic-apm-node v1.8.1 as well