Resolve a module name or path relative to an arbitrary directory