Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is place in module lookup #678

Open
Aryan3212 opened this issue Oct 9, 2022 · 1 comment
Open

What is place in module lookup #678

Aryan3212 opened this issue Oct 9, 2022 · 1 comment

Comments

@Aryan3212
Copy link

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
Copy link

plbstl commented Jun 20, 2023

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

  • is it a folder? - yes
  • does it have a package.json file? - yes
  • does the package.json file contain a main key/value pair? - yes
    {
      "name": "foo",
      "main": "./lib.js"
      // ...
    }
  • does a file exist in the path specified (./lib.js)? - yes

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants