substack/node-resolve — pull request #24 by willthefrog (2013-07-16 02:13:13+00:00)
Title: Fix type error when `main` field points to a dir

In some npm packages (e.g., validator, superagent), the `main` filed in package.json file points to a dir (e.g, './lib'). When trying to resolve these packages, node-resolve will throw `TypeError: Cannot read property 'main' of undefined` because `loadAsFile` did not pass the `pkg` argument when falling through.