-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 required-ness of "name" and "version" in package.json files #134
Conversation
I think npm itself actually always requires these fields, whether the package is published or not. |
@ljharb npm requires them in the package's top-level package.json, but does not require them for package.json files that are in its subdirectories. The usage pattern that triggers this is the one documented here: https://nodejs.org/api/packages.html#type This is useful in particular when a package transpiles TS into JS and provides both CJS and ESM endpoints: microsoft/TypeScript#18442 (comment). |
I agree, but the package being published or not isn't the discriminator - it's required in any package, including a private:true one. |
I'm not completely sure about |
Is there a plan to merge/close this PR? |
I'm gonna close this in the interest of erroring on the side of being less confusing. While |
The current content of the Creating a package.json file page indicates that the
"name"
and"version"
fields are always requiredwhereas the actual package.json docs page clarifies this with:
This minor difference is causing some friction with e.g. Webpack making an assumption based on the former page, resulting in webpack/webpack#13457.
It would be good to get this specified; this PR attempts to do so with (hopefully!) sufficiently simple language.