Fix type error when `main` field points to a dir #24

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

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.

@AlexMost AlexMost referenced this pull request in EugeneN/cafe Jul 18, 2013

Closed

build failure #38

i've met the same problem, here is my pull request. substack#26. Beside passing pkg to callback, it also returns the proper error message when the main file is missing in package.

Collaborator

substack commented Aug 3, 2013

Thanks for the patch. I merged a very similar patch from #27 that also included tests.

@substack substack closed this Aug 3, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment