What is mean file:workspaces in package dependencies?

Viewed 518

I try use npm 7 workspaces

"workspaces": {
    "packages": [
      "packages/apps/*",
      "packages/components",
    ],

and after install I see in my package.json

  "dependencies": {
    "@project/components": "file:workspaces/components",

Is it correct ? And what is mean file: ?

1 Answers

Workspaces is a generic term that refers to the set of features in the npm CLI that provides support to managing multiple packages from your local files system from within a singular top-level, root package.

For more details

Defining workspaces

Workspaces are usually defined via the workspaces property of the package.json file, e.g:

{
  "name": "my-workspaces-powered-project",
  "workspaces": [
    "workspace-a"
  ]
}

Given the above package.json example living at a current working directory . that contains a folder named workspace-a that itself contains a package.json inside it, defining a Node.js package, e.g:

.
+-- package.json
`-- workspace-a
   `-- package.json
Related