Yarn 2/3 link via resolution for local development breaks staging
Asked Answered
S

1

9

Just upgraded from Yarn 1 to Yarn 3.

In my package.json of my "Project 1" I have a dependencies to my published package

dependencies: {
  ...
  "@my-package/name": "3.4"
  ...
}

With Yarn 1 not altering package.json when linking "Project 1" to "@my-package/name" for local development, that worked fine.

Linking my local version of the package with Yarn 2/3, it now added

  "resolutions": {
    "@my-package/name": "portal:../name"
  }

This breaks the build process during deployment on staging/production environments. That link is only meant for local development, while on other environments it should be ignored and (only) the published package above should be used. Any idea if / how this is now possible?

Here is the ticket on that issue/change https://github.com/yarnpkg/berry/issues/90

Stalk answered 7/11, 2021 at 23:58 Comment(0)
G
4

In yarn 3, I tried:

yarn link ~/local/package/path

It added:

"resolutions": {
  "@namespace/package": "portal:/home/src/repo/local/package/path"
}

was working for me to deploy in staging env for testing. (Note: We have different setup for prod)

Ghyll answered 20/10, 2022 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.