Skip to content

Commit

Permalink
Don't fail if main module fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
eush77 committed Jul 24, 2015
1 parent 8daf315 commit a96e4a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ module.exports = function (repl, dir, opts) {
skipFailures: ee.emit.bind(ee, 'fail') });

if (opts.loadMain) {
modules[path.basename(dir)] = require.resolve(dir);
try {
var name = path.basename(dir);
modules[name] = require.resolve(dir);
}
catch (e) {
ee.emit('fail', name, dir);
}
}

modules = mapKeys(modules, camelCase);
Expand Down

0 comments on commit a96e4a5

Please sign in to comment.