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

doc: clarify that import also uses main #41720

Merged
merged 5 commits into from
Jan 30, 2022

Conversation

benmccann
Copy link
Contributor

The docs currently make it sound like main is only used when a package is included via require(). However, if you import a package, it still uses the main field

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/modules

@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label Jan 27, 2022
@benmccann benmccann changed the title docs: clarify that import also uses main doc: clarify that import also uses main Jan 27, 2022
@ljharb
Copy link
Member

ljharb commented Jan 27, 2022

LGTM

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the link and the example only applies to require() (import does not support folders as modules).
I agree we should make it clearer that it defines the package entry point if there are no "exports" field, but maybe in a different paragraph.

@benmccann
Copy link
Contributor Author

Thanks for the review! I've attempted to reword it. Let me know what you think

Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the new version. A few suggestions:

doc/api/packages.md Outdated Show resolved Hide resolved
doc/api/packages.md Outdated Show resolved Hide resolved
benmccann and others added 2 commits January 28, 2022 08:27
Co-authored-by: Antoine du Hamel <[email protected]>
Co-authored-by: Antoine du Hamel <[email protected]>
@aduh95
Copy link
Contributor

aduh95 commented Jan 28, 2022

Can you please remove this paragraph?

node/doc/api/packages.md

Lines 1109 to 1110 in 1f964a5

When a package has an [`"exports"`][] field, this will take precedence over the
`"main"` field when importing the package by name.

It's repeated from 10 lines above:

node/doc/api/packages.md

Lines 1099 to 1100 in 1f964a5

When a package has an [`"exports"`][] field, this will take precedence over the
`"main"` field when importing the package by name.

@benmccann
Copy link
Contributor Author

done

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jan 28, 2022
@Mesteery Mesteery added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 30, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 30, 2022
@nodejs-github-bot nodejs-github-bot merged commit 253f934 into nodejs:master Jan 30, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 253f934

@benmccann benmccann deleted the main-import branch January 30, 2022 17:13
ruyadorno pushed a commit that referenced this pull request Feb 8, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Mar 2, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Mar 3, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this pull request Mar 14, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants