require-hacker icon indicating copy to clipboard operation
require-hacker copied to clipboard

global_hook doesn't deal well with circular dependencies

Open billiegoose opened this issue 7 years ago • 1 comments

I'm trying to build a better node "require" algorithm, and your module has been very helpful! However, I run into a problem when packages have circular dependencies.

Because of this line here I believe:

// flush require() cache
delete require.cache[resolved_path]

Since I can only return source code, I can't reference an existing module. If I return undefined then node doesn't get it from its cache either, but looks for it in the "node_modules" folder (which is what I'm trying to avoid). Any suggestions?

billiegoose avatar Nov 19 '17 03:11 billiegoose