app-module-path-node
app-module-path-node copied to clipboard
specify how this works in readme.md
Hi all
Checking this library out - trying to figure out how it works - it looks like it doesn't use NODE_PATH (that wouldn't really be possible given the nature of this), so how does it work?
I probably won't use it unless I know how it works, will try to poke around some more to figure it out
This module works by monkey-patching the internal require('module').Module._nodeModulePaths
method to prepend additional directories: https://github.com/patrick-steele-idem/app-module-path-node/blob/97fc60947bcca6e194f549d0d374ef34a5eb49df/lib/index.js#L7-L17
You may want to consider using the more recent require-self-ref module as an alternative. Both app-module-path
and require-self-ref
work, but I find require-self-ref
to be cleaner. require-self-ref
monkey patches the internal require('module').Module. _resolveFilename
method.
I don't have time to update the README at the moment, but hopefully that helps clarify.
thanks that helps! you probably could just copy and paste this answer to the top of the readme
it's up to you if you want to merge it
https://github.com/patrick-steele-idem/app-module-path-node/pull/24
thanks