Check candidates after ranges

This way builtins are checked for correctly when the
range isn’t found
This commit is contained in:
Kevin Sawicki
2014-10-13 16:21:40 -04:00
parent 6a6c7b1852
commit a0ae526017

View File

@@ -121,9 +121,6 @@ resolveModulePath = (relativePath, parentModule) ->
return if relativePath[0] is '.'
return if isAbsolute(relativePath)
candidates = cache.dependencies[relativePath]
return unless candidates?
folderPath = path.dirname(parentModule.filename)
range = cache.folders[folderPath]?[relativePath]
@@ -133,6 +130,9 @@ resolveModulePath = (relativePath, parentModule) ->
else
return
candidates = cache.dependencies[relativePath]
return unless candidates?
for version, resolvedPath of candidates
if Module._cache.hasOwnProperty(resolvedPath) or isCorePath(resolvedPath)
return resolvedPath if satisfies(version, range)