Wednesday, 10 November 2021

Yarn nohoist without using workspaces

One of my projects suddenly failed to compile on a Windows laptop, where the exact same code was working on a Mac. I've read about hoisting and adding nohoist, which seemed to fix the problem for Apollo client.

"workspaces": {
    "packages": [
      "packages/*"
    ],
    "nohoist": [
      "**/tslib",
      "**/tslib/**"
    ]
}

Now, I don't use workspaces, but since I am using the code above in package.json, Yarn asks for the -W parameter when adding or removing packages saying:

error Running this command will add the dependency to the workspace root rather than
the workspace itself, which might not be what you want - if you really meant it, make it
explicit by running this command again with the -W flag (or --ignore-workspace-root-check).

It doesn't seem to me like this is the best way to go. What should I do?



from Yarn nohoist without using workspaces

No comments:

Post a Comment