0
Follow
0
View

Can pnpm replace npm link // yarn link?

duron571 注册会员
2023-01-25 13:48

There are three ways.

You may use the file protocol to reference your local lib:

{
  "dependencies": {
    "lib": "file:../lib"
  }
}

In this case, pnpm will create hard links to each file of lib. It will look like lib is copied to the node_modules of your app.

You may use the link protocol:

{
  "dependencies": {
    "lib": "link:../lib"
  }
}

In this case, pnpm will create a symlink to your lib in app/node_modules/lib.

Or you may pack your lib into a tarball with pnpm pack and then install it through the file protocol

{
  "dependencies": {
    "lib": "file:../lib/lib-1.0.0.tgz"
  }
}

There is no way to "publish to a local store".

About the Author

Question Info

Publish Time
2023-01-25 13:48
Update Time
2023-01-25 13:48