   return unless candidates?
 
   for version, resolvedPath of candidates
-    if Module._cache.hasOwnProperty(resolvedPath) or resolvedPath.indexOf(cache.resourcePath) is 0
+    if Module._cache.hasOwnProperty(resolvedPath) or isCorePath(resolvedPath)
       return resolvedPath if satisfies(version, range)
 
   return

  return if relativePath[relativePath.length - 1] is '/'

  resolvedPath = path.resolve(path.dirname(parentModule.filename), relativePath)
  if resolvedPath.indexOf(cache.resourcePath) is 0
    extension = path.extname(resolvedPath)
    if extension
      return resolvedPath if cache.extensions[extension]?.has(resolvedPath)
    else
      for extension, paths of cache.extensions
        resolvedPathWithExtension = "#{resolvedPath}#{extension}"
        return resolvedPathWithExtension if paths.has(resolvedPathWithExtension)

  return


  isAbsolute = (pathToCheck) ->
    pathToCheck and pathToCheck[0] is '/'

isCorePath = (pathToCheck) ->
  pathToCheck.indexOf(cache.resourcePathWithTrailingSlash) is 0

loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) ->
  fs = require 'fs-plus'

