From 97e0ddf15d7c3652dd142a4aaea0ca97c4f66831 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 7 Jan 2015 10:53:33 -0800 Subject: [PATCH] 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 --- src/module-cache.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/module-cache.coffee b/src/module-cache.coffee index 6c9209095..b4d51dd51 100644 --- a/src/module-cache.coffee +++ b/src/module-cache.coffee @@ -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