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

@benmccann benmccann commented Jan 27, 2022

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
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 27, 2022

Review requested:

@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 ljharb commented Jan 27, 2022

LGTM

Copy link
Contributor

@aduh95 aduh95 left a comment

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

@benmccann benmccann commented Jan 28, 2022

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

Copy link
Contributor

@aduh95 aduh95 left a comment

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 Jan 28, 2022
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@aduh95
Copy link
Contributor

@aduh95 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

@benmccann benmccann commented Jan 28, 2022

done

aduh95
aduh95 approved these changes Jan 28, 2022
@nodejs-github-bot nodejs-github-bot merged commit 253f934 into nodejs:master Jan 30, 2022
20 checks passed
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 30, 2022

Landed in 253f934

@benmccann benmccann deleted the main-import branch Jan 30, 2022
ruyadorno added a commit that referenced this issue Feb 8, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams added a commit that referenced this issue Mar 2, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams added a commit that referenced this issue Mar 3, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams added a commit that referenced this issue Mar 14, 2022
PR-URL: #41720
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants