How to build projects in Monorepository that use shared components

I am using a lerna monorepo with (at the moment) two projects within the “packages” folder as well as a “shared-components” folder in it that gets consumed from both apps.
So the structure is as follows:

  • packages
    • project-a
    • project-b
    • shared-components
  • package.json
  • lerna.json

I set up netlify to use packages/project-a as the base path and for the other site packages/project-b.
It is working just fine and when something changes in project-a only project A gets build and not all the apps.
Problem now is that when something changes in the “shared-components” folder the build gets cancelled as it is not part of the base directory.

Is it possible to fix this somehow?

Thanks in advance!
Greetings, Stefan

Yup! You’ll have to write a custom build.ignore script that checks for changes where you intend them to have effects. This thread’s several example responses are a good starting place for inspiration:

The script is documented in small detail here: