'Package-lock.json - requires vs dependencies

In package-lock.json in dependency object, I have both requires and dependencies fields, e.g

  "requires": {
    "@angular-devkit/core": "0.8.5",
    "rxjs": "6.2.2",
    "tree-kill": "1.2.0",
    "webpack-sources": "1.3.0"
  },
  "dependencies": {
    "rxjs": {
      "version": "6.2.2",
      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz",
      "integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==",
      "dev": true,
      "requires": {
        "tslib": "1.9.3"
      }
    }
  }

What is the difference between these two? Why some dependencies are listed in requires, other in dependencies, and some of them in both of these fields?



Solution 1:[1]

After reading the answers above, maybe I can put it more simply:

requires can be shared among all other top levels dependencies, while dependencies are standalone, belonging only to the module requiring them.

i.e.

"@angular-devkit/core": "0.8.5","tree-kill": "1.2.0", and "webpack-sources": "1.3.0" do not belong only to the module. They are in the same level as the module requiring them. By contrast, "rxjs": "6.2.2" exists exclusively due to the module requiring it, and it is used only by that module.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 JWess