require-hacker
require-hacker copied to clipboard
global_hook doesn't deal well with circular dependencies
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?