I’m having trouble with the new monorepo deployment options to the point that I can’t deploy a site that uses a standard monorepo setup with
Netlify have the option to change the base directory for sites now which means I can built from multiple directories - which is great - but it only uses yarn if it finds a yarn.lock in the directory that sites are built from. In most monorepos I have multiple sites but also
packages that are shared between sites. With a yarn workspaces setup you would not have a yarn.lock for each site or the package directory:
/yarn.lock /site-a/ /* no yarn lock so will use npm */ /site-b/ /* no yarn lock so will use npm */ /packages/shared-module/ /* no yarn lock */
Since we don’t have lock files in package directories it will not install correctly because yarn workspaces is aware that
/packages/shared-module/ is a local package but npm is not.
Sorry that is quite technical and very specific to monorepos but it really makes the new Netlify features difficult to use with real monorepos and it could possibly be “easily” fixed. Or perhaps you know a workaround?
I’m trying to write about this at the moment and I’d love to promote these features.