简体   繁体   中英

Should package.json `name` and `version` be placed at the top level of JSON?

If the name field is not placed at the top level in package.json file in the manner illustrated below, is it recognized Or Not?

Is there an npmjs specification indicating that these syntaxes are allowed?

{
  "dummy": {
    "name": "project"
  },
  "version": "1.0.0"
}

I read this page, but there was no description of how deep each field should be placed in package.json, and if there is no name, version field, etc. https://docs.npmjs.com/creating-a-package-json-file

That way "name" won't be recognized by most tooling, no.

Extensions not specified in the NPM package.json spec are allowed (but gently discouraged, IIRC).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM