Null out mainPath on resolve errors

The scope of this variable is outside the loop so this prevent
cache corruption based on using the mainPath value from previous
module.

Refs atom/atom-space-pen-views#5
This commit is contained in:
Kevin Sawicki 2015-01-07 10:53:33 -08:00
parent fb3cc5554c
commit 97e0ddf15d

View File

@ -59,6 +59,8 @@ loadDependencies = (modulePath, rootPath, rootMetadata, moduleCache) ->
if childMetadata?.version
try
mainPath = require.resolve(childPath)
catch error
mainPath = null
if mainPath
moduleCache.dependencies.push