I’m using a monorepo with Yarn workspaces as a means to manage a dozen or so WordPress plugins. Each plugin needs to be able to build (webpack) and deploy independently.
The issue happens occasionally while adding packages or using yarn upgrade-interactive
. The yarn.lock
files of the children end up not reflecting all of the dependencies that they require. The packages will build correctly locally, but will fail to build on the remote server because of missing packages (that are presumably present locally because of one of their siblings or parent).
This can be resolved by removing the contents of yarn.lock
and running yarn install
in the child. However, I would like to figure out the root cause and prevent it.
My .yarnrc.yml files are all:
compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.3.1.cjs
and my root package.json has its workspaces defined as:
{
"workspaces": [
"themes/*",
"plugins/*"
]
}