Multiple netlify.toml files in monorepo

I’m struggling to understand the new monorepo support from only the blog post and brief paragraph in the docs.

One fundamental question I have is: does this mean we can drop different netlify.toml files in our monorepo package subdirs? The blog post doesn’t mention this, or really any other technical specifics.

The paragraph in the docs says you can configure your base dir in the netlify.toml file. But if the base dir is specified in the netlify.toml that seems to me to require that the netlify.toml file is in the monorepo root.

So I assumed that we’d still have to configure the base dir in the Netlify UI, so that the build process knew where to find the correct netlify.toml file (that is, in the monorepo package subdir).

Am I just misunderstanding this? Does the new monorepo support not permit a netlify.toml file in each website subdir? The folks in this thread seem to think it does support multiple netlify.toml files… :thinking:

It would be fantastic if the docs specifically addressed this issue, it seems fairly core to understanding the feature.

Thanks so much for working on monorepo support – that’s hugely important for us and it’s great to know it’s on your radar. Would love to see some work on the remaining issues with monorepos built with yarn workspaces worked out as well.

1 Like

I’ve confirmed that the monorepo support does in fact support multiple netlify.toml files. I also tested what would happen if you put a netlify.toml in the monorepo root and then also one in the site package subdir. I was hoping Netlify would merge the two config files, preferring the subdir one in case of duplication, but in fact, it seems to totally ignore the monorepo root one and only find or care about the one in the base directory (sub-package).

The docs around this are still pretty small and somewhat misleading. For instance they reference setting your base directory in the netlify toml – but if you’re trying to use the new monorepo support, you can’t do that – you have to set the base dir in the UI so that Netlify will go there and find the netlify.toml there and give you the benefit of skipping publishing when the subdir doesn’t change.

1 Like

You should be able to put the netlify.toml in each subdir, if the base is configured in the UI, yes.

If you have one in the root that doesn’t have base set, that should be fine. If base is set it in, and doesn’t match what’s in the UI, not sure what would happen (so, don’t set base in that netlify.toml unless you have only one netlify site, is my suggestion).

Does that help?

I will also review this feedback with our documentation team who are working specifically on the monorepo docs this sprint.