Exclude package in yarn workspaces

Using latest version.

Do you want to request a feature or report a bug?
feature query

What is the current behavior?
Unable to exclude a package (completely) from the workspaces. Just wanna put it out there that I am not talking about excluding dependencies from being hoisted, I am talking about complete exclusion of a package from a workspace, while being in one. I know it doesn’t make sense to put something inside workspace in the first place if it’s not gonna share any dependencies but thats how I want the setup to be. Any pattern matching I can add to exclude while specifying directories in the “workspaces” field of package.json???


Author: Fantashit

2 thoughts on “Exclude package in yarn workspaces

  1. I don’t think the package specification lets you omit directories. The simple thing to do is just not put that package in /packages. I’ll tag this as a feature request.

  2. Or use Lerna for this case (https://github.com/lerna/lerna/tree/master/core/filter-options)? It interops with yarn workspaces nicely.

    Do you have an example of how to solve this feature request with Lerna?

    If I understand the request, can’t you run commands against all workspaces whilst ignoring the one you want to isolate?
    E.g. I have package-a, package-b and a create-react-app demo called cra-demo that tests them. To build only my packages I could run
    lerna run --ignore cra-demo build
    lerna run --scope package-* build

    Apologies if I missed the intent of the OP. It would probably help if we better understood why @Pranit-Harekar wants to isolate his package?

Comments are closed.