-
Notifications
You must be signed in to change notification settings - Fork 3.7k
docs: added type field in the documentation of package.json #1653
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think rather than all of this content, it should be nothing more than a link to https://nodejs.org/api/packages.html#type, so that there's not two sources of truth to keep up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is generally the position we have also taken in other places in the docs. "nothing more" is a little extreme, some helpful copy explaining that the source of truth is found elsewhere would be appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sure, that works fine :-) just, nothing technical, ie that would need to be updated in the future.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add documentation for package.json
typefieldWhat / Why
This PR adds comprehensive documentation for the
typefield in package.json, which was previously undocumented in the npm CLI documentation. Thetypefield is an important Node.js feature that determines how.jsfiles are interpreted (as ES modules or CommonJS modules) and was missing from the official npm package.json documentation.Changes made:
typefield between theexportsandmainsections"module"and"commonjs"values.js,.mjs,.cjs)This addition helps developers understand how to properly configure their packages for ES modules or CommonJS, which is crucial for modern Node.js development.
References
Fixes npm/cli#[8376] - Documents the missing
typefield in package.json