Skip to content
Browse files

don't try to read directories as config files

  • Loading branch information...
1 parent c2aaffa commit 843fd030707e26fb6a0b1ee4db3506a4702b8239 @paulbaumgart paulbaumgart committed May 16, 2012
Showing with 11 additions and 4 deletions.
  1. +11 −4 lib/parse-config.js
View
15 lib/parse-config.js
@@ -55,10 +55,17 @@ function _readConfigFile(configFile, env) {
function _resolvePaths(pathsToTry, dir) {
var file;
for (var i = 0, len = pathsToTry.length; i < len; i++) {
- file = path.resolve(dir, pathsToTry[i]);
+ var pathToTry = pathsToTry[i];
+ if (!pathToTry) {
+ continue;
+ }
+
+ file = path.resolve(dir, pathToTry);
+
try {
- fs.statSync(file);
- break;
+ if (fs.statSync(file).isFile()) {
+ break;
+ }
} catch (e) {
file = null;
}
@@ -76,7 +83,7 @@ function _findEntryFile(dir) {
}
function parseConfig(configFile, env, ignoreMissingEntryFile) {
- configFile = path.resolve(configFile || _resolvePaths([ configFile, 'jsbundle.json' ]));
+ configFile = configFile || _resolvePaths([ configFile, 'jsbundle.json' ]);
var configDir = path.dirname(configFile);
var entryFile;

0 comments on commit 843fd03

Please sign in to comment.
Something went wrong with that request. Please try again.