简体   繁体   中英

How to symlink a package in workspace without updating yarn.lock?

package.json -

"workspaces": [
  "packages/*",
  "samples/*"
],
"packageManager": "yarn@3.1.0"

I want to install and symlink the dependencies in samples but I don't want the yarn install to update the yarn.lock file. Is there a setting in workspaces or yarn to achieve this?

I think you want to use yarn add your-package@"workspace:^" (or other workspace: ranges ). This does end up in your yarn.lock , but when publishing your package yarn will actually replace the dependency with a versioned dependency (depending on the range specifier). Also, it doesn't include any hash or anything in the yarn.lock, so you don't need to reinstall when changes are made to the package.

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