1

If I want to make a function that intercepts all require calls in the entire Node process (even those made from dependencies), is this possible?

1 Answer 1

2

You could redefine the require function on the global object at the start of the process like so:

global.require = function(...) {};
Sign up to request clarification or add additional context in comments.

1 Comment

As of NodeJS v7.2.0, this appears not to be working.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.