basarat / typescript-book

:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹
https://basarat.gitbook.io/typescript/
Other
20.77k stars 2.54k forks source link

What is place in module lookup #678

Open Aryan3212 opened 1 year ago

Aryan3212 commented 1 year ago

https://basarat.gitbook.io/typescript/project/modules/external-modules#what-is-place

else if the place is a folder and there is a foo/package.json and a file specified in the types key in the package.json that exists, then hurray! else if the place is a folder and there is a package.json and a file specified in the main key in the package.json that exists, then hurray! Does the second line here (4th in the book) imply foo/package.json?

plbstl commented 1 year ago

For example; ../node_modules/foo is the current place

Then 🎉 🎊

Does the second line here (4th in the book) imply foo/package.json?

It implies foo/(path in main field of package.json)

In this example, it implies foo/lib.js.